[llvm-commits] CVS: llvm/include/llvm/Constants.h

Zhou Sheng zhousheng00 at gmail.com
Fri Mar 30 09:50:45 PDT 2007



Changes in directory llvm/include/llvm:

Constants.h updated: 1.142 -> 1.143
---
Log message:

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


---
Diffs of the changes:  (+2 -1)

 Constants.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.142 llvm/include/llvm/Constants.h:1.143
--- llvm/include/llvm/Constants.h:1.142	Fri Mar 30 00:10:59 2007
+++ llvm/include/llvm/Constants.h	Fri Mar 30 11:50:28 2007
@@ -187,7 +187,8 @@
   /// 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






More information about the llvm-commits mailing list