diff options
author | Zhou Sheng <zhousheng00@gmail.com> | 2007-03-30 16:50:28 +0000 |
---|---|---|
committer | Zhou Sheng <zhousheng00@gmail.com> | 2007-03-30 16:50:28 +0000 |
commit | 02d3ac689543ef45de9890dc6835f9acd653278c (patch) | |
tree | 096ffe576ccf5501bae1269281b717820745930c /llvm | |
parent | 8c3d3dce2bbb1424dac6d52bfecba14374dcf99d (diff) | |
download | bcm5719-llvm-02d3ac689543ef45de9890dc6835f9acd653278c.tar.gz bcm5719-llvm-02d3ac689543ef45de9890dc6835f9acd653278c.zip |
Make sure this method just return value equal or less than Limit.
llvm-svn: 35509
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/Constants.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h index e7020d36998..a36ac6e7474 100644 --- a/llvm/include/llvm/Constants.h +++ b/llvm/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 |