Header for muldiv.c.
More...
Go to the source code of this file.
|
#define | CEIL_DIV(a, b) (((a)+((b)-1))/(b)) |
|
Header for muldiv.c.
Definition in file muldiv.h.
◆ round_to_next_multiple_of()
unsigned round_to_next_multiple_of |
( |
unsigned |
number, |
|
|
unsigned |
divisor |
|
) |
| |
Return the lowest x such that x is at least number, and x modulo divisor == 0. If no such x can be expressed as an unsigned, return UINT_MAX. Asserts if divisor is zero.
Definition at line 21 of file muldiv.c.
◆ round_uint32_to_next_multiple_of()
uint32_t round_uint32_to_next_multiple_of |
( |
uint32_t |
number, |
|
|
uint32_t |
divisor |
|
) |
| |
Return the lowest x such that x is at least number, and x modulo divisor == 0. If no such x can be expressed as a uint32_t, return UINT32_MAX. Asserts if divisor is zero.
Definition at line 35 of file muldiv.c.
◆ round_uint64_to_next_multiple_of()
uint64_t round_uint64_to_next_multiple_of |
( |
uint64_t |
number, |
|
|
uint64_t |
divisor |
|
) |
| |
Return the lowest x such that x is at least number, and x modulo divisor == 0. If no such x can be expressed as a uint64_t, return UINT64_MAX. Asserts if divisor is zero.
Definition at line 50 of file muldiv.c.
◆ tor_mul_u64_nowrap()
uint64_t tor_mul_u64_nowrap |
( |
uint64_t |
a, |
|
|
uint64_t |
b |
|
) |
| |
Return the unsigned integer product of a and b. If overflow is detected, return UINT64_MAX instead.
Definition at line 75 of file muldiv.c.