about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--lib/Expr/Expr.cpp7
-rw-r--r--test/Feature/DeterministicSwitch.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/Expr/Expr.cpp b/lib/Expr/Expr.cpp
index f73d1614..a5c7f652 100644
--- a/lib/Expr/Expr.cpp
+++ b/lib/Expr/Expr.cpp
@@ -182,7 +182,12 @@ unsigned Expr::computeHash() {
 }
 
 unsigned ConstantExpr::computeHash() {
-  hashValue = hash_value(value) ^ (getWidth() * MAGIC_HASH_CONSTANT);
+  Expr::Width w = getWidth();
+  if (w <= 64)
+    hashValue = value.getLimitedValue() ^ (w * MAGIC_HASH_CONSTANT);
+  else
+    hashValue = hash_value(value) ^ (w * MAGIC_HASH_CONSTANT);
+
   return hashValue;
 }
 
diff --git a/test/Feature/DeterministicSwitch.c b/test/Feature/DeterministicSwitch.c
index b6c186ff..fc83063b 100644
--- a/test/Feature/DeterministicSwitch.c
+++ b/test/Feature/DeterministicSwitch.c
@@ -27,11 +27,11 @@ int main(int argc, char **argv) {
   }
 
   // CHECK-DFS: default
-  // CHECK-DFS: space
   // CHECK-DFS: tab
+  // CHECK-DFS: space
 
-  // CHECK-BFS: tab
   // CHECK-BFS: space
+  // CHECK-BFS: tab
   // CHECK-BFS: default
 
   return 0;