From 09f39ae2ccea78ecd37facc5431c51e4c9666630 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Wed, 26 Oct 2016 20:10:32 +0100 Subject: Better constant strings for SSA; Fix Type_Info --- src/common.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/common.cpp') diff --git a/src/common.cpp b/src/common.cpp index 44ee869cb..d0703378c 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -215,14 +215,15 @@ struct Map { Array > entries; }; -template void map_init (Map *h, gbAllocator a); -template void map_destroy(Map *h); -template T * map_get (Map *h, HashKey key); -template void map_set (Map *h, HashKey key, T value); -template void map_remove (Map *h, HashKey key); -template void map_clear (Map *h); -template void map_grow (Map *h); -template void map_rehash (Map *h, isize new_count); +template void map_init (Map *h, gbAllocator a); +template void map_init_with_reserve(Map *h, gbAllocator a, isize capacity); +template void map_destroy (Map *h); +template T * map_get (Map *h, HashKey key); +template void map_set (Map *h, HashKey key, T value); +template void map_remove (Map *h, HashKey key); +template void map_clear (Map *h); +template void map_grow (Map *h); +template void map_rehash (Map *h, isize new_count); template MapEntry *multi_map_find_first(Map *h, HashKey key); template MapEntry *multi_map_find_next (Map *h, MapEntry *e); @@ -242,6 +243,12 @@ gb_inline void map_init(Map *h, gbAllocator a) { array_init(&h->entries, a); } +template +gb_inline void map_init_with_reserve(Map *h, gbAllocator a, isize capacity) { + array_init(&h->hashes, a, capacity); + array_init(&h->entries, a, capacity); +} + template gb_inline void map_destroy(Map *h) { array_free(&h->entries); -- cgit v1.2.3