For PR1188:

Compute BitMask correctly.

Patch by Leo (wenwenti@hotmail.com).

llvm-svn: 34026
This commit is contained in:
Reid Spencer 2007-02-08 00:29:31 +00:00
parent 709750c3d3
commit 0690d442ab
2 changed files with 2 additions and 2 deletions

View File

@ -1307,7 +1307,7 @@ void Interpreter::visitAShr(BinaryOperator &I) {
#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) { \

View File

@ -236,7 +236,7 @@ private: // Helper functions
};
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)