From 4139c9af86edfb9a6d4846518f12f6347632bdc9 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 6 Nov 2009 10:22:49 +0300 Subject: [PATCH] hash_init: check for size being power of two It's really a bug if size is not power of two. We must to be sure all callers are sane. Signed-off-by: Cyrill Gorcunov --- hashtbl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hashtbl.c b/hashtbl.c index 879dd937..348bc40d 100644 --- a/hashtbl.c +++ b/hashtbl.c @@ -63,6 +63,7 @@ static struct hash_tbl_node *alloc_table(size_t newsize) void hash_init(struct hash_table *head, size_t size) { + nasm_assert(is_power2(size)); head->table = alloc_table(size); head->load = 0; head->size = size;