diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-07-09 16:54:17 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-11-12 11:33:48 -0500 |
commit | 1f7ba115a46743ea09402a30a7b11e4b6d2ee52e (patch) | |
tree | dcbefd24ee447826411d433d3ca3e2eca1d938fe /src/common | |
parent | 0694263b7533ba000d3d95a2936115b21b806a5d (diff) | |
download | tor-1f7ba115a46743ea09402a30a7b11e4b6d2ee52e.tar.gz tor-1f7ba115a46743ea09402a30a7b11e4b6d2ee52e.zip |
Rename cast_double_to_int64 to clamp_double_to_int64
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/util.c | 4 | ||||
-rw-r--r-- | src/common/util.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/common/util.c b/src/common/util.c index 63bd1cc6f3..f642c6a6dd 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -565,7 +565,7 @@ sample_laplace_distribution(double mu, double b, double p) result = mu - b * (p > 0.5 ? 1.0 : -1.0) * tor_mathlog(1.0 - 2.0 * fabs(p - 0.5)); - return cast_double_to_int64(result); + return clamp_double_to_int64(result); } /** Add random noise between INT64_MIN and INT64_MAX coming from a Laplace @@ -5509,7 +5509,7 @@ tor_weak_random_range(tor_weak_rng_t *rng, int32_t top) /** Cast a given double value to a int64_t. Return 0 if number is NaN. * Returns either INT64_MIN or INT64_MAX if number is outside of the int64_t * range. */ -int64_t cast_double_to_int64(double number) +int64_t clamp_double_to_int64(double number) { int exp; diff --git a/src/common/util.h b/src/common/util.h index e303da2795..8e18e0514c 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -185,7 +185,7 @@ int64_t sample_laplace_distribution(double mu, double b, double p); int64_t add_laplace_noise(int64_t signal, double random, double delta_f, double epsilon); int n_bits_set_u8(uint8_t v); -int64_t cast_double_to_int64(double number); +int64_t clamp_double_to_int64(double number); /* Compute the CEIL of <b>a</b> divided by <b>b</b>, for nonnegative <b>a</b> * and positive <b>b</b>. Works on integer types only. Not defined if a+b can |