summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-12-04 16:37:47 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-12-04 16:37:47 +0000
commit5d75f0bdddb48837def2fad2bc2ad3359b414a16 (patch)
treee6cea93d2706b2ce34bae7160745288bb1ec3999
parent31920b0a2a04fbdf3d85f7ddbe55de6928437c56 (diff)
downloadbcm5719-llvm-5d75f0bdddb48837def2fad2bc2ad3359b414a16.tar.gz
bcm5719-llvm-5d75f0bdddb48837def2fad2bc2ad3359b414a16.zip
Simplify APInt::getAllOnesValue.
llvm-svn: 120911
-rw-r--r--llvm/include/llvm/ADT/APInt.h11
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index ec92e8f4b29..b3cd38af15d 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/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.
OpenPOWER on IntegriCloud