forked from OSchip/llvm-project
TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstruction().
Reported by Yang Yongyong, thanks! llvm-svn: 171101
This commit is contained in:
parent
794a73124b
commit
bf99a426cb
|
@ -1866,7 +1866,7 @@ static void emitFieldFromInstruction(formatted_raw_ostream &OS) {
|
|||
<< " if (numBits == sizeof(InsnType)*8)\n"
|
||||
<< " fieldMask = (InsnType)(-1LL);\n"
|
||||
<< " else\n"
|
||||
<< " fieldMask = ((1 << numBits) - 1) << startBit;\n"
|
||||
<< " fieldMask = (((InsnType)1 << numBits) - 1) << startBit;\n"
|
||||
<< " return (insn & fieldMask) >> startBit;\n"
|
||||
<< "}\n\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue