diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-12-04 16:37:47 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-12-04 16:37:47 +0000 |
commit | bd7d2622a2ee828a02017dca19170b6f79ff6684 (patch) | |
tree | 0e6cd7da94d18f2a5afa8fb748d7f68f136f5f20 | |
parent | 3069cbf7b3ef9a31bbb8e434686b7259052c364a (diff) | |
download | external_llvm-bd7d2622a2ee828a02017dca19170b6f79ff6684.zip external_llvm-bd7d2622a2ee828a02017dca19170b6f79ff6684.tar.gz external_llvm-bd7d2622a2ee828a02017dca19170b6f79ff6684.tar.bz2 |
Simplify APInt::getAllOnesValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120911 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/APInt.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index ec92e8f..b3cd38a 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -379,15 +379,12 @@ public: /// @{ /// @brief Gets maximum unsigned value of APInt for specific bit width. static APInt getMaxValue(unsigned numBits) { - APInt API(numBits, 0); - API.setAllBits(); - return API; + return getAllOnesValue(numBits); } /// @brief Gets maximum signed value of APInt for a specific bit width. static APInt getSignedMaxValue(unsigned numBits) { - APInt API(numBits, 0); - API.setAllBits(); + APInt API = getAllOnesValue(numBits); API.clearBit(numBits - 1); return API; } @@ -414,9 +411,7 @@ public: /// @returns the all-ones value for an APInt of the specified bit-width. /// @brief Get the all-ones value. static APInt getAllOnesValue(unsigned numBits) { - APInt API(numBits, 0); - API.setAllBits(); - return API; + return APInt(numBits, -1ULL, true); } /// @returns the '0' value for an APInt of the specified bit-width. |