diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-27 20:24:31 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-27 20:24:31 +0000 |
commit | 66ed1099ff3591c61e008198bb5a30862e778fc0 (patch) | |
tree | 19af021ae37a37340e5f77a57ed7b2b55d37674c /lib/Support/APInt.cpp | |
parent | 96d91372fd79257bb043f6a01b7e871acbe5a555 (diff) |
Improve APInt interface:
1. Add unsigned and signed versions of methods so a "bool" argument doesn't
need to be passed in.
2. Make the various getMin/getMax functions all be inline since they are
so simple.
3. Simplify sdiv and srem code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r-- | lib/Support/APInt.cpp | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 6939c21b81..acc9de295b 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -654,39 +654,6 @@ APInt& APInt::flip(uint32_t bitPosition) { return *this; } -/// getMaxValue - This function returns the largest value -/// for an APInt of the specified bit-width and if isSign == true, -/// it should be largest signed value, otherwise unsigned value. -APInt APInt::getMaxValue(uint32_t numBits, bool isSign) { - APInt Result(numBits, 0); - Result.set(); - if (isSign) - Result.clear(numBits - 1); - return Result; -} - -/// getMinValue - This function returns the smallest value for -/// an APInt of the given bit-width and if isSign == true, -/// it should be smallest signed value, otherwise zero. -APInt APInt::getMinValue(uint32_t numBits, bool isSign) { - APInt Result(numBits, 0); - if (isSign) - Result.set(numBits - 1); - return Result; -} - -/// getAllOnesValue - This function returns an all-ones value for -/// an APInt of the specified bit-width. -APInt APInt::getAllOnesValue(uint32_t numBits) { - return getMaxValue(numBits, false); -} - -/// getNullValue - This function creates an '0' value for an -/// APInt of the specified bit-width. -APInt APInt::getNullValue(uint32_t numBits) { - return getMinValue(numBits, false); -} - uint64_t APInt::getHashValue() const { // Put the bit width into the low order bits. uint64_t hash = BitWidth; @@ -1734,6 +1701,6 @@ void APInt::dump() const else for (unsigned i = getNumWords(); i > 0; i--) { cerr << pVal[i-1] << " "; } - cerr << " (" << this->toString(10, false) << ")\n" << std::setbase(10); + cerr << " (" << this->toString(10) << ")\n" << std::setbase(10); } #endif |