mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Remove round_int64_to_next_multiple_of: It is now unused.
This commit is contained in:
parent
2775dd8649
commit
f2205071f0
@ -513,21 +513,6 @@ round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor)
|
|||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the lowest x in [INT64_MIN, INT64_MAX] such that x is at least
|
|
||||||
* <b>number</b>, and x modulo <b>divisor</b> == 0. If no such x can be
|
|
||||||
* expressed as an int64_t, return INT64_MAX */
|
|
||||||
int64_t
|
|
||||||
round_int64_to_next_multiple_of(int64_t number, int64_t divisor)
|
|
||||||
{
|
|
||||||
tor_assert(divisor > 0);
|
|
||||||
if (INT64_MAX - divisor + 1 < number)
|
|
||||||
return INT64_MAX;
|
|
||||||
if (number >= 0)
|
|
||||||
number += divisor - 1;
|
|
||||||
number -= number % divisor;
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Transform a random value <b>p</b> from the uniform distribution in
|
/** Transform a random value <b>p</b> from the uniform distribution in
|
||||||
* [0.0, 1.0[ into a Laplace distributed value with location parameter
|
* [0.0, 1.0[ into a Laplace distributed value with location parameter
|
||||||
* <b>mu</b> and scale parameter <b>b</b>. Truncate the final result
|
* <b>mu</b> and scale parameter <b>b</b>. Truncate the final result
|
||||||
|
@ -145,7 +145,6 @@ uint64_t round_to_power_of_2(uint64_t u64);
|
|||||||
unsigned round_to_next_multiple_of(unsigned number, unsigned divisor);
|
unsigned round_to_next_multiple_of(unsigned number, unsigned divisor);
|
||||||
uint32_t round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor);
|
uint32_t round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor);
|
||||||
uint64_t round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor);
|
uint64_t round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor);
|
||||||
int64_t round_int64_to_next_multiple_of(int64_t number, int64_t divisor);
|
|
||||||
int64_t sample_laplace_distribution(double mu, double b, double p);
|
int64_t sample_laplace_distribution(double mu, double b, double p);
|
||||||
int64_t add_laplace_noise(int64_t signal, double random, double delta_f,
|
int64_t add_laplace_noise(int64_t signal, double random, double delta_f,
|
||||||
double epsilon);
|
double epsilon);
|
||||||
|
@ -4223,21 +4223,6 @@ test_util_round_to_next_multiple_of(void *arg)
|
|||||||
tt_u64_op(round_uint64_to_next_multiple_of(UINT64_MAX,2), ==,
|
tt_u64_op(round_uint64_to_next_multiple_of(UINT64_MAX,2), ==,
|
||||||
UINT64_MAX);
|
UINT64_MAX);
|
||||||
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(0,1), ==, 0);
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(0,7), ==, 0);
|
|
||||||
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(99,1), ==, 99);
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(99,7), ==, 105);
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(99,9), ==, 99);
|
|
||||||
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(-99,1), ==, -99);
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(-99,7), ==, -98);
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(-99,9), ==, -99);
|
|
||||||
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(INT64_MIN,2), ==, INT64_MIN);
|
|
||||||
tt_i64_op(round_int64_to_next_multiple_of(INT64_MAX,2), ==,
|
|
||||||
INT64_MAX);
|
|
||||||
|
|
||||||
tt_int_op(round_uint32_to_next_multiple_of(0,1), ==, 0);
|
tt_int_op(round_uint32_to_next_multiple_of(0,1), ==, 0);
|
||||||
tt_int_op(round_uint32_to_next_multiple_of(0,7), ==, 0);
|
tt_int_op(round_uint32_to_next_multiple_of(0,7), ==, 0);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user