aboutsummaryrefslogtreecommitdiff
path: root/src/lib/intmath/bits.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-22 09:48:24 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-22 09:49:13 -0400
commit2cf033f238c111bef62552da16117568435d3a18 (patch)
tree34deb903de7bbdf42c399dce861e63c898c77dae /src/lib/intmath/bits.h
parent3883338c8121212b3f6f9c020d489d50bbcdd855 (diff)
downloadtor-2cf033f238c111bef62552da16117568435d3a18.tar.gz
tor-2cf033f238c111bef62552da16117568435d3a18.zip
Extract simple integer math into its own module
Diffstat (limited to 'src/lib/intmath/bits.h')
-rw-r--r--src/lib/intmath/bits.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/intmath/bits.h b/src/lib/intmath/bits.h
new file mode 100644
index 0000000000..70f855089c
--- /dev/null
+++ b/src/lib/intmath/bits.h
@@ -0,0 +1,16 @@
+/* Copyright (c) 2003-2004, Roger Dingledine
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2018, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#ifndef TOR_INTMATH_BITS_H
+#define TOR_INTMATH_BITS_H
+
+#include "lib/cc/torint.h"
+#include "lib/cc/compat_compiler.h"
+
+int tor_log2(uint64_t u64) ATTR_CONST;
+uint64_t round_to_power_of_2(uint64_t u64);
+int n_bits_set_u8(uint8_t v);
+
+#endif /* !defined(TOR_INTMATH_BITS_H) */