aboutsummaryrefslogtreecommitdiff
path: root/src/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.cpp')
-rw-r--r--src/common.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/common.cpp b/src/common.cpp
index 7af7026b9..cca478421 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -275,9 +275,9 @@ gb_global String global_module_path = {0};
gb_global bool global_module_path_set = false;
-#include "string_map.cpp"
-#include "map.cpp"
+#include "ptr_map.cpp"
#include "ptr_set.cpp"
+#include "string_map.cpp"
#include "string_set.cpp"
#include "priority_queue.cpp"
#include "thread_pool.cpp"
@@ -289,13 +289,13 @@ struct StringIntern {
char str[1];
};
-Map<StringIntern *> string_intern_map = {}; // Key: u64
+PtrMap<uintptr, StringIntern *> string_intern_map = {}; // Key: u64
gb_global Arena string_intern_arena = {};
char const *string_intern(char const *text, isize len) {
u64 hash = gb_fnv64a(text, len);
- u64 key = hash ? hash : 1;
- StringIntern **found = map_get(&string_intern_map, hash_integer(key));
+ uintptr key = cast(uintptr)(hash ? hash : 1);
+ StringIntern **found = map_get(&string_intern_map, key);
if (found) {
for (StringIntern *it = *found; it != nullptr; it = it->next) {
if (it->len == len && gb_strncmp(it->str, (char *)text, len) == 0) {
@@ -309,7 +309,7 @@ char const *string_intern(char const *text, isize len) {
new_intern->next = found ? *found : nullptr;
gb_memmove(new_intern->str, text, len);
new_intern->str[len] = 0;
- map_set(&string_intern_map, hash_integer(key), new_intern);
+ map_set(&string_intern_map, key, new_intern);
return new_intern->str;
}