[llvm-commits] CVS: llvm/include/llvm/Constants.h
Zhou Sheng
zhousheng00 at gmail.com
Thu Mar 29 20:23:12 PDT 2007
Changes in directory llvm/include/llvm:
Constants.h updated: 1.140 -> 1.141
---
Log message:
Add two utility methods into ConstantInt.
---
Diffs of the changes: (+16 -0)
Constants.h | 16 ++++++++++++++++
1 files changed, 16 insertions(+)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.140 llvm/include/llvm/Constants.h:1.141
--- llvm/include/llvm/Constants.h:1.140 Fri Mar 23 13:44:11 2007
+++ llvm/include/llvm/Constants.h Thu Mar 29 22:22:55 2007
@@ -174,6 +174,22 @@
return Val.isMinValue();
}
+ /// This function will return true iff this constant represents a value with
+ /// active bits bigger than 64 bits or a value greater than the given uint64_t
+ /// value.
+ /// @returns true iff this constant is greater or equal to the given number.
+ /// @brief Determine if the value is greater or equal to the given number.
+ bool greaterOrEqual(uint64_t Num) {
+ return Val.getActiveBits() > 64 || Val.getZExtValue() > Num;
+ }
+
+ /// @returns the 64-bit value of this constant if its active bits number is
+ /// 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();
+ }
+
/// @returns the value for an integer constant of the given type that has all
/// its bits set to true.
/// @brief Get the all ones value
More information about the llvm-commits
mailing list