mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-12 18:40:23 +08:00
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:
parent
2967fee0bb
commit
4139c9af86
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user