Browse Source

Use `PtrMap` temporarily

gingerBill 6 months ago
parent
commit
1d348318f2
3 changed files with 5 additions and 5 deletions
  1. 3 3
      src/checker.cpp
  2. 1 1
      src/checker.hpp
  3. 1 1
      src/common.cpp

+ 3 - 3
src/checker.cpp

@@ -1651,7 +1651,7 @@ gb_internal isize type_info_index(CheckerInfo *info, TypeInfoPair pair, bool err
 	mutex_lock(&info->minimum_dependency_type_info_mutex);
 
 	isize entry_index = -1;
-	uintptr hash = cast(uintptr)pair.hash;
+	u64 hash = pair.hash;
 	isize *found_entry_index = map_get(&info->minimum_dependency_type_info_index_map, hash);
 	if (found_entry_index) {
 		entry_index = *found_entry_index;
@@ -6744,12 +6744,12 @@ gb_internal void check_parsed_files(Checker *c) {
 
 		for_array(i, c->info.type_info_types) {
 			auto const &tt = c->info.type_info_types[i];
-			bool exists = map_set_if_not_previously_exists(&c->info.minimum_dependency_type_info_index_map, cast(uintptr)tt.hash, i);
+			bool exists = map_set_if_not_previously_exists(&c->info.minimum_dependency_type_info_index_map, tt.hash, i);
 			if (!exists) {
 				continue;
 			}
 			for (auto const &entry : c->info.minimum_dependency_type_info_index_map) {
-				if (entry.key != cast(uintptr)tt.hash) {
+				if (entry.key != tt.hash) {
 					continue;
 				}
 				auto const &other = c->info.type_info_types[entry.value];

+ 1 - 1
src/checker.hpp

@@ -429,7 +429,7 @@ struct CheckerInfo {
 	Entity *              entry_point;
 	PtrSet<Entity *>      minimum_dependency_set;
 	BlockingMutex minimum_dependency_type_info_mutex;
-	PtrMap</*type info hash*/uintptr, /*min dep index*/isize> minimum_dependency_type_info_index_map;
+	PtrMap</*type info hash*/u64, /*min dep index*/isize> minimum_dependency_type_info_index_map;
 	TypeSet min_dep_type_info_set;
 	Array<TypeInfoPair> type_info_types; // sorted after filled
 

+ 1 - 1
src/common.cpp

@@ -387,7 +387,7 @@ gb_global Arena string_intern_arena = {};
 
 gb_internal char const *string_intern(char const *text, isize len) {
 	u64 hash = gb_fnv64a(text, len);
-	uintptr key = cast(uintptr)(hash ? hash : 1);
+	u64 key = hash ? hash : 1;
 	StringIntern **found = map_get(&string_intern_map, key);
 	if (found) {
 		for (StringIntern *it = *found; it != nullptr; it = it->next) {