diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-14 00:01:35 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-03-14 00:01:35 +0000 |
commit | 4c6a918cda4143b82a7e0a86cfa106dfcec755cd (patch) | |
tree | 1134e033bf390b76bcfb69a0c1dd493e102c35bf | |
parent | 64cab1220abaeaffe07cb1162187dd91da3017b5 (diff) | |
download | bcm5719-llvm-4c6a918cda4143b82a7e0a86cfa106dfcec755cd.tar.gz bcm5719-llvm-4c6a918cda4143b82a7e0a86cfa106dfcec755cd.zip |
Move APInt::operator! inline, it's small and fuses well with surrounding code when inlined.
llvm-svn: 152688
-rw-r--r-- | llvm/include/llvm/ADT/APInt.h | 10 | ||||
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 10 |
2 files changed, 9 insertions, 11 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index b08564ca733..d8ed2224985 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -561,7 +561,15 @@ public: /// Performs logical negation operation on this APInt. /// @returns true if *this is zero, false otherwise. /// @brief Logical negation operator. - bool operator!() const; + bool operator!() const { + if (isSingleWord()) + return !VAL; + + for (unsigned i = 0; i != getNumWords(); ++i) + if (pVal[i]) + return false; + return true; + } /// @} /// @name Assignment Operators diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index e5423f153c3..c5713a0eb17 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -457,16 +457,6 @@ APInt APInt::XorSlowCase(const APInt& RHS) const { return APInt(val, getBitWidth()).clearUnusedBits(); } -bool APInt::operator !() const { - if (isSingleWord()) - return !VAL; - - for (unsigned i = 0; i < getNumWords(); ++i) - if (pVal[i]) - return false; - return true; -} - APInt APInt::operator*(const APInt& RHS) const { assert(BitWidth == RHS.BitWidth && "Bit widths must be the same"); if (isSingleWord()) |