aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/CodeEmitterGen.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-05 18:31:58 +0000
committerChris Lattner <sabre@nondot.org>2008-10-05 18:31:58 +0000
commit1cfa0776c3053b894bcc8c74610e09118340aad3 (patch)
treec0fa5106ab52bf2ad0ad6b3afa3525850a62376c /utils/TableGen/CodeEmitterGen.cpp
parent834eb40f442ae0862b8e283f8f4e0203bd436c56 (diff)
Fix shift overflow bug that would occur when a field was a full 32-bits
in tblgen. This is PR2827, thanks to Waldemar Knorr for tracking this down. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57124 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeEmitterGen.cpp')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index 62df686ea2..ae4a6aa445 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -191,7 +191,7 @@ void CodeEmitterGen::run(std::ostream &o) {
gotOp = true;
}
- unsigned opMask = (1 << N) - 1;
+ unsigned opMask = ~0U >> (32-N);
int opShift = beginVarBit - N + 1;
opMask <<= opShift;
opShift = beginInstBit - beginVarBit;