aboutsummaryrefslogtreecommitdiff
path: root/src/common.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-10-26 20:10:32 +0100
committerGinger Bill <bill@gingerbill.org>2016-10-26 20:10:32 +0100
commit09f39ae2ccea78ecd37facc5431c51e4c9666630 (patch)
treeb42adb2c539be81df9e1d48be19f7c4713fe01c7 /src/common.cpp
parentaed7a83f5b8e812b3c2c31bdf745a3107da80190 (diff)
Better constant strings for SSA; Fix Type_Info
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp23
1 files changed, 15 insertions, 8 deletions
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<MapEntry<T> > entries;
};
-template <typename T> void map_init (Map<T> *h, gbAllocator a);
-template <typename T> void map_destroy(Map<T> *h);
-template <typename T> T * map_get (Map<T> *h, HashKey key);
-template <typename T> void map_set (Map<T> *h, HashKey key, T value);
-template <typename T> void map_remove (Map<T> *h, HashKey key);
-template <typename T> void map_clear (Map<T> *h);
-template <typename T> void map_grow (Map<T> *h);
-template <typename T> void map_rehash (Map<T> *h, isize new_count);
+template <typename T> void map_init (Map<T> *h, gbAllocator a);
+template <typename T> void map_init_with_reserve(Map<T> *h, gbAllocator a, isize capacity);
+template <typename T> void map_destroy (Map<T> *h);
+template <typename T> T * map_get (Map<T> *h, HashKey key);
+template <typename T> void map_set (Map<T> *h, HashKey key, T value);
+template <typename T> void map_remove (Map<T> *h, HashKey key);
+template <typename T> void map_clear (Map<T> *h);
+template <typename T> void map_grow (Map<T> *h);
+template <typename T> void map_rehash (Map<T> *h, isize new_count);
template <typename T> MapEntry<T> *multi_map_find_first(Map<T> *h, HashKey key);
template <typename T> MapEntry<T> *multi_map_find_next (Map<T> *h, MapEntry<T> *e);
@@ -243,6 +244,12 @@ gb_inline void map_init(Map<T> *h, gbAllocator a) {
}
template <typename T>
+gb_inline void map_init_with_reserve(Map<T> *h, gbAllocator a, isize capacity) {
+ array_init(&h->hashes, a, capacity);
+ array_init(&h->entries, a, capacity);
+}
+
+template <typename T>
gb_inline void map_destroy(Map<T> *h) {
array_free(&h->entries);
array_free(&h->hashes);