From 90645f5598ca8b25cd2692f2ac0d2778a3fd2755 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 4 Jan 2013 22:29:21 +0000 Subject: 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 --- bgpd/bgp_aspath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bgpd') diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index c37a8897..a8b078ff 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1856,7 +1856,7 @@ aspath_cmp (const void *arg1, const void *arg2) void aspath_init (void) { - ashash = hash_create_size (32767, aspath_key_make, aspath_cmp); + ashash = hash_create_size (32768, aspath_key_make, aspath_cmp); } void -- cgit v1.2.1