From: Chris Lattner Date: Sun, 5 Oct 2008 18:31:58 +0000 (+0000) Subject: Fix shift overflow bug that would occur when a field was a full 32-bits X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1cfa0776c3053b894bcc8c74610e09118340aad3;p=oota-llvm.git 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 --- diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index 62df686ea28..ae4a6aa445b 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;