aboutsummaryrefslogtreecommitdiff
path: root/utils/TableGen/FixedLenDecoderEmitter.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-12-26 06:43:14 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-12-26 06:43:14 +0000
commitfc093def2d892a2ea068d3b9e6d5839c187cc942 (patch)
treea275e5687c740da434cb8898015bbaf1c6393563 /utils/TableGen/FixedLenDecoderEmitter.cpp
parent00ba3014d8f6694b03997022259e5b266e5e112a (diff)
TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstruction().
Reported by Yang Yongyong, thanks! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/FixedLenDecoderEmitter.cpp')
-rw-r--r--utils/TableGen/FixedLenDecoderEmitter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/TableGen/FixedLenDecoderEmitter.cpp b/utils/TableGen/FixedLenDecoderEmitter.cpp
index b2dc878880..0c3017f389 100644
--- a/utils/TableGen/FixedLenDecoderEmitter.cpp
+++ b/utils/TableGen/FixedLenDecoderEmitter.cpp
@@ -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";
}