Changes in directory llvm/include/llvm/ADT:
APInt.h updated: 1.34 -> 1.35 --- Log message: Add an abs() function to get the absolute value. --- Diffs of the changes: (+8 -0) APInt.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.34 llvm/include/llvm/ADT/APInt.h:1.35 --- llvm/include/llvm/ADT/APInt.h:1.34 Thu Mar 1 14:39:01 2007 +++ llvm/include/llvm/ADT/APInt.h Thu Mar 1 17:37:09 2007 @@ -759,6 +759,14 @@ /// @brief Compute the square root APInt sqrt() const; + + /// If *this is < 0 then return -(*this), otherwise *this; + /// @brief Get the absolute value; + APInt abs() const { + if (isNegative()) + return -(*this); + return *this; + } }; inline bool operator==(uint64_t V1, const APInt& V2) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits