aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-07-13 22:43:06 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2009-07-13 22:43:06 +0200
commit8f1a973669284e5662bd6f23bc96ecfafa57c554 (patch)
treef8145dc47dee99bc85814d3bac2056a8c134e51a /src/common/util.h
parent707a44a7b0e12f9aef541dd69b356e2f123bcda8 (diff)
downloadtor-8f1a973669284e5662bd6f23bc96ecfafa57c554.tar.gz
tor-8f1a973669284e5662bd6f23bc96ecfafa57c554.zip
Two tweaks to exit-port statistics.
Add two functions for round_to_next_multiple_of() for uint32_t and uint64_t. Avoid division in every step of the loop over all ports.
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h
index 18033f39df..1c5643be39 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -154,6 +154,9 @@ void tor_log_mallinfo(int severity);
/* Math functions */
int tor_log2(uint64_t u64) ATTR_CONST;
uint64_t round_to_power_of_2(uint64_t u64);
+unsigned round_to_next_multiple_of(unsigned number, unsigned 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);
/* String manipulation */