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

Zhou Sheng zhousheng00 at gmail.com
Thu Jan 11 06:31:25 PST 2007



Changes in directory llvm/include/llvm:

Constants.h updated: 1.114 -> 1.115
---
Log message:

Fixed a bug in ConstantInt::Inverted().
Modified comment of that method.


---
Diffs of the changes:  (+3 -3)

 Constants.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.114 llvm/include/llvm/Constants.h:1.115
--- llvm/include/llvm/Constants.h:1.114	Thu Jan 11 06:24:13 2007
+++ llvm/include/llvm/Constants.h	Thu Jan 11 08:31:10 2007
@@ -96,13 +96,13 @@
   /// @brief Get a ConstantInt for a specific value.
   static ConstantInt *get(const Type *Ty, int64_t V);
 
-  /// Returns the opposite value of this ConstantInt value if it's a boolean 
-  /// constant.
+  /// Returns the opposite value of this ConstantInt. 
   /// @brief Get inverse value.
   inline ConstantInt *inverted() const {
     static ConstantInt *CI = 0;
     if (CI) return CI; 
-    return CI = new ConstantInt(getType(), Val ^ (-1));
+    return CI = new ConstantInt(getType(), 
+                                Val ^ (getType() == Type::BoolTy ? 1 : -1));
   }
 
   /// @returns the value of this ConstantInt only if it's a boolean type.






More information about the llvm-commits mailing list