diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-05-24 17:12:57 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-05-24 17:12:57 +0000 |
commit | d3d86b17a761011f62dc2e06c04c0af8f1a75ef6 (patch) | |
tree | efb329c2d77ef6f39c02db8db62bfa18ad5f4d6d /src/common/util.h | |
parent | d0a5c4f9848f44c46f001428bd3078673033ef19 (diff) | |
download | tor-d3d86b17a761011f62dc2e06c04c0af8f1a75ef6.tar.gz tor-d3d86b17a761011f62dc2e06c04c0af8f1a75ef6.zip |
r12916@catbus: nickm | 2007-05-24 12:43:45 -0400
Add math functions to round values to the nearest power of 2. Make mempools more careful about making sure that the size of their chunks is a little less than a power of 2, not a little more.
svn:r10304
Diffstat (limited to 'src/common/util.h')
-rw-r--r-- | src/common/util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/util.h b/src/common/util.h index 6b32708c5e..f04160935d 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -142,6 +142,10 @@ extern int dmalloc_free(const char *file, const int line, void *pnt, /** Macro: true if two values have different boolean values. */ #define bool_neq(a,b) (!(a)!=!(b)) +/* Math functions */ +int tor_log2(uint64_t u64) ATTR_CONST; +uint64_t round_to_power_of_2(uint64_t u64); + /* String manipulation */ /** Allowable characters in a hexadecimal string. */ |