summaryrefslogtreecommitdiff
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorZhou Sheng <zhousheng00@gmail.com>2007-03-30 16:50:28 +0000
committerZhou Sheng <zhousheng00@gmail.com>2007-03-30 16:50:28 +0000
commit4ac93f9fa3b33511f3e1e5160a226204a1912981 (patch)
tree9b4e1b51986e46abc32fc88bf3cb161b1cc649cc /include/llvm/Constants.h
parent97e0c22330f1856a7e026d162040aafdb2a70d0e (diff)
downloadllvm-4ac93f9fa3b33511f3e1e5160a226204a1912981.tar.gz
llvm-4ac93f9fa3b33511f3e1e5160a226204a1912981.tar.bz2
llvm-4ac93f9fa3b33511f3e1e5160a226204a1912981.tar.xz
Make sure this method just return value equal or less than Limit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index e7020d3699..a36ac6e747 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -187,7 +187,8 @@ public:
/// not greater than 64, otherwise, just return the given uint64_t number.
/// @brief Get the constant's value if possible.
uint64_t getLimitedValue(uint64_t Limit) {
- return (Val.getActiveBits() > 64) ? Limit : Val.getZExtValue();
+ return (Val.getActiveBits() > 64 || Val.getZExtValue() > Limit) ?
+ Limit : Val.getZExtValue();
}
/// @returns the value for an integer constant of the given type that has all