|
static int32_t | min32 (int32_t a, int32_t b) |
|
static int32_t | max32 (int32_t a, int32_t b) |
|
static int64_t | min64 (int64_t a, int64_t b) |
|
static int64_t | max64 (int64_t a, int64_t b) |
|
static uint32_t | min32u (uint32_t a, uint32_t b) |
|
static uint32_t | max32u (uint32_t a, uint32_t b) |
|
static uint64_t | min64u (uint64_t a, uint64_t b) |
|
static uint64_t | max64u (uint64_t a, uint64_t b) |
|
M0_INTERNAL bool | m0_mod_gt (uint64_t x0, uint64_t x1) |
|
M0_INTERNAL bool | m0_mod_ge (uint64_t x0, uint64_t x1) |
|
static uint64_t | m0_clip64u (uint64_t lo, uint64_t hi, uint64_t x) |
|
M0_INTERNAL uint64_t | m0_rnd (uint64_t max, uint64_t *seed) |
|
M0_INTERNAL uint64_t | m0_rnd64 (uint64_t *seed) |
|
M0_INTERNAL uint64_t | m0_gcd64 (uint64_t p, uint64_t q) |
|
static bool | m0_is_po2 (uint64_t val) |
|
static unsigned | m0_log2 (uint64_t val) |
|
static uint64_t | m0_align (uint64_t val, uint64_t alignment) |
|
static bool | m0_is_aligned (uint64_t val, uint64_t alignment) |
|
static bool | m0_addu64_will_overflow (uint64_t a, uint64_t b) |
|
static uint64_t | m0_enc (uint64_t width, uint64_t row, uint64_t column) |
|
static void | m0_dec (uint64_t width, uint64_t pos, uint64_t *row, uint64_t *column) |
|
M0_INTERNAL bool m0_mod_gt |
( |
uint64_t |
x0, |
|
|
uint64_t |
x1 |
|
) |
| |
Compares two 64bit numbers "modulo overflow".
This function returns true iff x0 == x1 + delta, where delta is a positive signed 64bit number (alternatively speaking, delta is an unsigned 64bit number less than UINT64_MAX/2).
This function is useful for comparing rolling counters (like epoch numbers, times, log sequence numbers, etc.) which can overflow, but only "close
enough" values ever get compared.
As a safety measure, function checks that values are close enough.
- See also
- m0_mod_ge()
Definition at line 171 of file misc.c.