23 raw_assert(divisor > 0);
24 if (UINT_MAX - divisor + 1 < number)
26 number += divisor - 1;
27 number -= number % divisor;
37 raw_assert(divisor > 0);
38 if (UINT32_MAX - divisor + 1 < number)
41 number += divisor - 1;
42 number -= number % divisor;
52 raw_assert(divisor > 0);
53 if (UINT64_MAX - divisor + 1 < number)
55 number += divisor - 1;
56 number -= number % divisor;
62 gcd64(uint64_t a, uint64_t b)
77 if (a == 0 || b == 0) {
79 }
else if (PREDICT_UNLIKELY(UINT64_MAX / a < b)) {
89 simplify_fraction64(uint64_t *numer, uint64_t *denom)
92 uint64_t gcd = gcd64(*numer, *denom);
uint64_t tor_mul_u64_nowrap(uint64_t a, uint64_t b)
uint32_t round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor)
unsigned round_to_next_multiple_of(unsigned number, unsigned divisor)
uint64_t round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor)