[llvm-commits] CVS: llvm/lib/Support/APInt.cpp

Reid Spencer reid at x10sys.com
Tue Feb 27 12:24:49 PST 2007



Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.54 -> 1.55
---
Log message:

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.


---
Diffs of the changes:  (+1 -34)

 APInt.cpp |   35 +----------------------------------
 1 files changed, 1 insertion(+), 34 deletions(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.54 llvm/lib/Support/APInt.cpp:1.55
--- llvm/lib/Support/APInt.cpp:1.54	Tue Feb 27 13:31:09 2007
+++ llvm/lib/Support/APInt.cpp	Tue Feb 27 14:24:31 2007
@@ -654,39 +654,6 @@
   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 @@
   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






More information about the llvm-commits mailing list