1999-09-15 20:02:20 -04:00
|
|
|
/*
|
2018-02-23 03:53:12 -05:00
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2000-07-31 21:33:37 -04:00
|
|
|
*
|
2016-06-27 00:56:38 -04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2020-09-14 19:50:58 -04:00
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2018-02-23 03:53:12 -05:00
|
|
|
*
|
|
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
|
* information regarding copyright ownership.
|
1999-09-15 20:02:20 -04:00
|
|
|
*/
|
|
|
|
|
|
2005-04-27 00:57:32 -04:00
|
|
|
/*! \file */
|
|
|
|
|
|
2018-03-28 08:19:37 -04:00
|
|
|
#include <inttypes.h>
|
2020-02-12 09:33:32 -05:00
|
|
|
#include <stdbool.h>
|
2018-03-28 08:19:37 -04:00
|
|
|
|
1999-08-30 10:45:01 -04:00
|
|
|
#include <isc/serial.h>
|
|
|
|
|
|
2018-04-17 11:29:14 -04:00
|
|
|
bool
|
2020-02-14 00:35:17 -05:00
|
|
|
isc_serial_lt(uint32_t a, uint32_t b) {
|
1999-08-30 10:45:01 -04:00
|
|
|
/*
|
2018-04-17 11:29:14 -04:00
|
|
|
* Undefined => false
|
1999-08-30 10:45:01 -04:00
|
|
|
*/
|
2020-02-13 16:28:07 -05:00
|
|
|
if (a == (b ^ 0x80000000U)) {
|
2018-04-17 11:29:14 -04:00
|
|
|
return (false);
|
2020-02-13 16:28:07 -05:00
|
|
|
}
|
2018-04-17 11:29:14 -04:00
|
|
|
return (((int32_t)(a - b) < 0) ? true : false);
|
1999-08-30 10:45:01 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-17 11:29:14 -04:00
|
|
|
bool
|
2020-02-14 00:35:17 -05:00
|
|
|
isc_serial_gt(uint32_t a, uint32_t b) {
|
2018-04-17 11:29:14 -04:00
|
|
|
return (((int32_t)(a - b) > 0) ? true : false);
|
1999-08-30 10:45:01 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-17 11:29:14 -04:00
|
|
|
bool
|
2020-02-14 00:35:17 -05:00
|
|
|
isc_serial_le(uint32_t a, uint32_t b) {
|
2018-04-17 11:29:14 -04:00
|
|
|
return ((a == b) ? true : isc_serial_lt(a, b));
|
1999-08-30 10:45:01 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-17 11:29:14 -04:00
|
|
|
bool
|
2020-02-14 00:35:17 -05:00
|
|
|
isc_serial_ge(uint32_t a, uint32_t b) {
|
2018-04-17 11:29:14 -04:00
|
|
|
return ((a == b) ? true : isc_serial_gt(a, b));
|
1999-08-30 10:45:01 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-17 11:29:14 -04:00
|
|
|
bool
|
2020-02-14 00:35:17 -05:00
|
|
|
isc_serial_eq(uint32_t a, uint32_t b) {
|
2018-04-17 11:29:14 -04:00
|
|
|
return ((a == b) ? true : false);
|
1999-08-30 10:45:01 -04:00
|
|
|
}
|
|
|
|
|
|
2018-04-17 11:29:14 -04:00
|
|
|
bool
|
2020-02-14 00:35:17 -05:00
|
|
|
isc_serial_ne(uint32_t a, uint32_t b) {
|
2018-04-17 11:29:14 -04:00
|
|
|
return ((a != b) ? true : false);
|
1999-08-30 10:45:01 -04:00
|
|
|
}
|