| 571 | }; |
| 572 | |
| 573 | struct hash_table_struct* make_hash_table(agent* thisAgent, short minimum_log2size, |
| 574 | hash_function h) |
| 575 | { |
| 576 | hash_table* ht; |
| 577 | |
| 578 | ht = static_cast<hash_table_struct*>(allocate_memory(thisAgent, sizeof(hash_table), |
| 579 | HASH_TABLE_MEM_USAGE)); |
| 580 | ht->count = 0; |
| 581 | if (minimum_log2size < 1) |
| 582 | { |
| 583 | minimum_log2size = 1; |
| 584 | } |
| 585 | ht->size = static_cast<uint32_t>(1) << minimum_log2size; |
| 586 | ht->log2size = minimum_log2size; |
| 587 | ht->minimum_log2size = minimum_log2size; |
| 588 | ht->buckets = static_cast<item_in_hash_table_struct**>(allocate_memory_and_zerofill(thisAgent, ht->size * sizeof(char*), |
| 589 | HASH_TABLE_MEM_USAGE)); |
| 590 | ht->h = h; |
| 591 | return ht; |
| 592 | } |
| 593 | |
| 594 | void resize_hash_table(agent* thisAgent, hash_table* ht, short new_log2size) |
| 595 | { |
no test coverage detected