hash: force size to be a power of 2
By forcing the hash table size to be a power of 2, a potentially
expensive divide can be replaced by a mask operation. Almost all
usage of the hash table was using default size of 1024. Only places
with different size was thread library (1011) and bgp aspath.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/lib/hash.h b/lib/hash.h
index 4cb772e..a6dd531 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -41,7 +41,7 @@
/* Hash backet. */
struct hash_backet **index;
- /* Hash table size. */
+ /* Hash table size. Must be power of 2 */
unsigned int size;
/* Key make function. */