mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 02:09:24 +01:00
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.
This commit is contained in:
parent
002c5ca5d1
commit
2bf6f1cd39
@ -119,7 +119,7 @@ rate_per_sec_to_rate_per_step(uint32_t rate)
|
|||||||
*/
|
*/
|
||||||
uint64_t units = (uint64_t) rate * TICKS_PER_STEP;
|
uint64_t units = (uint64_t) rate * TICKS_PER_STEP;
|
||||||
uint32_t val = (uint32_t)
|
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;
|
return val ? val : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user