aboutsummaryrefslogtreecommitdiff
path: root/src/exact_value.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-15 09:56:11 +0000
committergingerBill <bill@gingerbill.org>2019-12-15 09:56:11 +0000
commit8bec32477995f5a48fdb784bebe522015aedb036 (patch)
tree02d2dc26a386dbfec9edcb6f21c14eb9828e579c /src/exact_value.cpp
parente6f26b9931af0b05b93447639fba7569691ac0d0 (diff)
Fix Duplicate integer switch case values incorrectly consider its absolute value #502
(Hashing proc was wrong for big ints)
Diffstat (limited to 'src/exact_value.cpp')
-rw-r--r--src/exact_value.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/exact_value.cpp b/src/exact_value.cpp
index 42b22c8ef..f4d2e60de 100644
--- a/src/exact_value.cpp
+++ b/src/exact_value.cpp
@@ -71,7 +71,12 @@ HashKey hash_exact_value(ExactValue v) {
case ExactValue_String:
return hash_string(v.value_string);
case ExactValue_Integer:
- return hashing_proc(big_int_ptr(&v.value_integer), v.value_integer.len * gb_size_of(u64));
+ {
+ HashKey key = hashing_proc(big_int_ptr(&v.value_integer), v.value_integer.len * gb_size_of(u64));
+ u8 last = (u8)v.value_integer.neg;
+ key.key = (key.key ^ last) * 0x100000001b3ll;
+ return key;
+ }
case ExactValue_Float:
return hash_f64(v.value_float);
case ExactValue_Pointer: