[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Interpreter.h

Reid Spencer reid at x10sys.com
Wed Feb 7 16:29:46 PST 2007



Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Execution.cpp updated: 1.167 -> 1.168
Interpreter.h updated: 1.82 -> 1.83
---
Log message:

For PR1188: http://llvm.org/PR1188 :
Compute BitMask correctly.

Patch by Leo (wenwenti at hotmail.com).


---
Diffs of the changes:  (+2 -2)

 Execution.cpp |    2 +-
 Interpreter.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.167 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.168
--- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.167	Thu Feb  1 20:16:22 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp	Wed Feb  7 18:29:31 2007
@@ -1307,7 +1307,7 @@
 
 #define INTEGER_ASSIGN(DEST, BITWIDTH, VAL)     \
   {                                             \
-    uint64_t Mask = (1ull << BITWIDTH) - 1;     \
+    uint64_t Mask = ~(uint64_t)(0ull) >> (64-BITWIDTH);     \
     if (BITWIDTH == 1) {                        \
       Dest.Int1Val = (bool) (VAL & Mask);       \
     } else if (BITWIDTH <= 8) {                 \


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.82 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.83
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.82	Thu Feb  1 20:16:22 2007
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h	Wed Feb  7 18:29:31 2007
@@ -236,7 +236,7 @@
 };
 
 inline void maskToBitWidth(GenericValue& GV, unsigned BitWidth) {
-  uint64_t BitMask = (1ull << BitWidth) - 1;
+  uint64_t BitMask = ~(uint64_t)(0ull) >> (64-BitWidth);
   if (BitWidth <= 8)
     GV.Int8Val &= BitMask;
   else if (BitWidth <= 16)






More information about the llvm-commits mailing list