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

Chris Lattner lattner at cs.uiuc.edu
Tue Nov 4 17:38:01 PST 2003


Changes in directory llvm/include/llvm:

ConstantHandling.h updated: 1.30 -> 1.31

---
Log message:

Fix spello
Add negate overload


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

Index: llvm/include/llvm/ConstantHandling.h
diff -u llvm/include/llvm/ConstantHandling.h:1.30 llvm/include/llvm/ConstantHandling.h:1.31
--- llvm/include/llvm/ConstantHandling.h:1.30	Mon Oct 20 15:19:13 2003
+++ llvm/include/llvm/ConstantHandling.h	Tue Nov  4 17:37:40 2003
@@ -134,9 +134,13 @@
 
 // Unary operators...
 inline Constant *operator~(const Constant &V) {
-  assert(V.getType()->isIntegral() && "Cannot invert non-intergral constant!");
+  assert(V.getType()->isIntegral() && "Cannot invert non-integral constant!");
   return ConstRules::get(V, V)->op_xor(&V,
                                     ConstantInt::getAllOnesValue(V.getType()));
+}
+
+inline Constant *operator-(const Constant &V) {
+  return ConstRules::get(V, V)->sub(Constant::getNullValue(V.getType()), &V);
 }
 
 // Standard binary operators...





More information about the llvm-commits mailing list