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>
This commit is contained in:
Cyrill Gorcunov 2009-11-06 10:22:49 +03:00
parent 2967fee0bb
commit 4139c9af86

View File

@ -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;