/src/bind9/lib/isc/serial.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) Internet Systems Consortium, Inc. ("ISC") |
3 | | * |
4 | | * SPDX-License-Identifier: MPL-2.0 |
5 | | * |
6 | | * This Source Code Form is subject to the terms of the Mozilla Public |
7 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
8 | | * file, you can obtain one at https://mozilla.org/MPL/2.0/. |
9 | | * |
10 | | * See the COPYRIGHT file distributed with this work for additional |
11 | | * information regarding copyright ownership. |
12 | | */ |
13 | | |
14 | | /*! \file */ |
15 | | |
16 | | #include <inttypes.h> |
17 | | #include <stdbool.h> |
18 | | |
19 | | #include <isc/serial.h> |
20 | | |
21 | | bool |
22 | 1.56k | isc_serial_lt(uint32_t a, uint32_t b) { |
23 | | /* |
24 | | * Undefined => false |
25 | | */ |
26 | 1.56k | if (a == (b ^ 0x80000000U)) { |
27 | 4 | return false; |
28 | 4 | } |
29 | 1.56k | return ((int32_t)(a - b) < 0) ? true : false; |
30 | 1.56k | } |
31 | | |
32 | | bool |
33 | 22.2k | isc_serial_gt(uint32_t a, uint32_t b) { |
34 | 22.2k | return ((int32_t)(a - b) > 0) ? true : false; |
35 | 22.2k | } |
36 | | |
37 | | bool |
38 | 0 | isc_serial_le(uint32_t a, uint32_t b) { |
39 | 0 | return (a == b) ? true : isc_serial_lt(a, b); |
40 | 0 | } |
41 | | |
42 | | bool |
43 | 0 | isc_serial_ge(uint32_t a, uint32_t b) { |
44 | 0 | return (a == b) ? true : isc_serial_gt(a, b); |
45 | 0 | } |
46 | | |
47 | | bool |
48 | 0 | isc_serial_eq(uint32_t a, uint32_t b) { |
49 | 0 | return (a == b) ? true : false; |
50 | 0 | } |
51 | | |
52 | | bool |
53 | 0 | isc_serial_ne(uint32_t a, uint32_t b) { |
54 | 0 | return (a != b) ? true : false; |
55 | 0 | } |