From 70cb5d42879f7d3451b6e5f5afbe716fd493faeb Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Tue, 27 Feb 2007 20:24:31 +0000 Subject: 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. llvm-svn: 34680 --- llvm/lib/Support/APInt.cpp | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) (limited to 'llvm/lib/Support') diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 6939c21b813..acc9de295b4 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/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 -- cgit v1.2.3