1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Make sure this method just return value equal or less than Limit.

llvm-svn: 35509
This commit is contained in:
Zhou Sheng 2007-03-30 16:50:28 +00:00
parent e1fed6f90d
commit 68b7faad88

View File

@ -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