aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2021-11-05 18:12:40 +0000
committerGitHub <noreply@github.com>2021-11-05 18:12:40 +0000
commitee259e42298eca0e4e5d6b8681c2403c3bf7a80e (patch)
tree7bfd15490ddc4be6fcd41b4f969df6c901d98f76 /src/check_stmt.cpp
parente963fc4d6a2b8fc63f46bb57b2c727999ce39e29 (diff)
parent36985f8da0cea59cb1912f62ae4e700983159b6a (diff)
Merge pull request #1273 from odin-lang/compiler-map-improvements
Compiler Map Improvements
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 103ffa071..24ad0eec1 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -699,7 +699,7 @@ struct TypeAndToken {
};
-void add_constant_switch_case(CheckerContext *ctx, Map<TypeAndToken> *seen, Operand operand, bool use_expr = true) {
+void add_constant_switch_case(CheckerContext *ctx, PtrMap<uintptr, TypeAndToken> *seen, Operand operand, bool use_expr = true) {
if (operand.mode != Addressing_Constant) {
return;
}
@@ -707,7 +707,7 @@ void add_constant_switch_case(CheckerContext *ctx, Map<TypeAndToken> *seen, Oper
return;
}
- HashKey key = hash_exact_value(operand.value);
+ uintptr key = hash_exact_value(operand.value);
TypeAndToken *found = map_get(seen, key);
if (found != nullptr) {
isize count = multi_map_count(seen, key);
@@ -964,7 +964,7 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
}
}
- Map<TypeAndToken> seen = {}; // NOTE(bill): Multimap, Key: ExactValue
+ PtrMap<uintptr, TypeAndToken> seen = {}; // NOTE(bill): Multimap, Key: ExactValue
map_init(&seen, heap_allocator());
defer (map_destroy(&seen));
@@ -1133,8 +1133,7 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
continue;
}
ExactValue v = f->Constant.value;
- HashKey key = hash_exact_value(v);
- auto found = map_get(&seen, key);
+ auto found = map_get(&seen, hash_exact_value(v));
if (!found) {
array_add(&unhandled, f);
}