[tor-commits] [tor/master] token bucket: Add parens to rate_per_sec_to_rate_per_step()
nickm at torproject.org
nickm at torproject.org
Tue Apr 17 15:12:59 UTC 2018
commit 2bf6f1cd39c102749ee518664036c90ab1dbfc9c
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Apr 17 11:09:55 2018 -0400
token bucket: Add parens to rate_per_sec_to_rate_per_step()
Typecasts bind more tightly than division, so we need to do the
division first.
---
src/common/token_bucket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/common/token_bucket.c b/src/common/token_bucket.c
index d18731b0e..747189e75 100644
--- a/src/common/token_bucket.c
+++ b/src/common/token_bucket.c
@@ -119,7 +119,7 @@ rate_per_sec_to_rate_per_step(uint32_t rate)
*/
uint64_t units = (uint64_t) rate * TICKS_PER_STEP;
uint32_t val = (uint32_t)
- monotime_coarse_stamp_units_to_approx_msec(units) / 1000;
+ (monotime_coarse_stamp_units_to_approx_msec(units) / 1000);
return val ? val : 1;
}
More information about the tor-commits
mailing list