summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-11-06 10:22:49 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2009-11-06 22:00:37 +0300
commit4139c9af86edfb9a6d4846518f12f6347632bdc9 (patch)
tree3be544047ee228498c0e8254c1414899ed3685d8
parent2967fee0bbf73e0b0590ef2ef66035d340a5f944 (diff)
downloadnasm-4139c9af86edfb9a6d4846518f12f6347632bdc9.tar.gz
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 <gorcunov@gmail.com>
-rw-r--r--hashtbl.c1
1 files changed, 1 insertions, 0 deletions
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;