aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-13 22:41:58 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-13 22:41:58 +0000
commitdb3faa64ee89d537ca1b1410dd841ef51e957540 (patch)
tree222c84cf8703f7d30344a58cc961fd49bb5d6c5c /lib/Support/APInt.cpp
parent36e37d29441c3f7b51259690e7aa5bc20834445e (diff)
Make some minor improvements to APInt:
1. Make all the operators use uppercase 2. Rename APIntRoundToDouble method just RoundToDouble, the APInt is redundant. 3. Turn the class on for compilation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index d81fb09bf6..cbd2b34703 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -14,7 +14,6 @@
#include "llvm/ADT/APInt.h"
-#if 0
#include "llvm/DerivedTypes.h"
#include "llvm/Support/MathExtras.h"
#include <cstring>
@@ -878,12 +877,12 @@ APInt APInt::getNullValue(unsigned numBits) {
/// HiBits - This function returns the high "numBits" bits of this APInt.
APInt APInt::HiBits(unsigned numBits) const {
- return APIntOps::lshr(*this, BitsNum - numBits);
+ return APIntOps::LShr(*this, BitsNum - numBits);
}
/// LoBits - This function returns the low "numBits" bits of this APInt.
APInt APInt::LoBits(unsigned numBits) const {
- return APIntOps::lshr(APIntOps::shl(*this, BitsNum - numBits),
+ return APIntOps::LShr(APIntOps::Shl(*this, BitsNum - numBits),
BitsNum - numBits);
}
@@ -949,7 +948,7 @@ APInt llvm::APIntOps::GreatestCommonDivisor(const APInt& API1,
APInt A = API1, B = API2;
while (!!B) {
APInt T = B;
- B = APIntOps::urem(A, B);
+ B = APIntOps::URem(A, B);
A = T;
}
return A;
@@ -972,18 +971,18 @@ APInt llvm::APIntOps::DoubleRoundToAPInt(double Double) {
return isNeg ? -APInt(mantissa >> (52 - exp)) :
APInt(mantissa >> (52 - exp));
APInt Tmp(mantissa, exp + 1);
- Tmp = Tmp.shl(exp - 52);
+ Tmp = Tmp.Shl(exp - 52);
return isNeg ? -Tmp : Tmp;
}
-/// APIntRoundToDouble - This function convert this APInt to a double.
+/// RoundToDouble - This function convert this APInt to a double.
/// The layout for double is as following (IEEE Standard 754):
/// --------------------------------------
/// | Sign Exponent Fraction Bias |
/// |-------------------------------------- |
/// | 1[63] 11[62-52] 52[51-00] 1023 |
/// --------------------------------------
-double APInt::APIntRoundToDouble(bool isSigned) const {
+double APInt::RoundToDouble(bool isSigned) const {
bool isNeg = isSigned ? (*this)[BitsNum-1] : false;
APInt Tmp(isNeg ? -(*this) : (*this));
if (Tmp.isSingleWord())
@@ -1020,7 +1019,7 @@ double APInt::APIntRoundToDouble(bool isSigned) const {
/// Arithmetic right-shift this APInt by shiftAmt.
/// @brief Arithmetic right-shift function.
-APInt APInt::ashr(unsigned shiftAmt) const {
+APInt APInt::AShr(unsigned shiftAmt) const {
APInt API(*this);
if (API.isSingleWord())
API.VAL = (((int64_t(API.VAL) << (64 - API.BitsNum)) >> (64 - API.BitsNum))
@@ -1046,7 +1045,7 @@ APInt APInt::ashr(unsigned shiftAmt) const {
/// Logical right-shift this APInt by shiftAmt.
/// @brief Logical right-shift function.
-APInt APInt::lshr(unsigned shiftAmt) const {
+APInt APInt::LShr(unsigned shiftAmt) const {
APInt API(*this);
if (API.isSingleWord())
API.VAL >>= shiftAmt;
@@ -1065,7 +1064,7 @@ APInt APInt::lshr(unsigned shiftAmt) const {
/// Left-shift this APInt by shiftAmt.
/// @brief Left-shift function.
-APInt APInt::shl(unsigned shiftAmt) const {
+APInt APInt::Shl(unsigned shiftAmt) const {
APInt API(*this);
if (API.isSingleWord())
API.VAL <<= shiftAmt;
@@ -1089,7 +1088,7 @@ APInt APInt::shl(unsigned shiftAmt) const {
/// Unsigned divide this APInt by APInt RHS.
/// @brief Unsigned division function for APInt.
-APInt APInt::udiv(const APInt& RHS) const {
+APInt APInt::UDiv(const APInt& RHS) const {
APInt API(*this);
unsigned first = RHS.getNumWords() * APInt::APINT_BITS_PER_WORD -
RHS.CountLeadingZeros();
@@ -1134,7 +1133,7 @@ APInt APInt::udiv(const APInt& RHS) const {
/// Unsigned remainder operation on APInt.
/// @brief Function for unsigned remainder operation.
-APInt APInt::urem(const APInt& RHS) const {
+APInt APInt::URem(const APInt& RHS) const {
APInt API(*this);
unsigned first = RHS.getNumWords() * APInt::APINT_BITS_PER_WORD -
RHS.CountLeadingZeros();
@@ -1176,6 +1175,3 @@ APInt APInt::urem(const APInt& RHS) const {
}
return API;
}
-
-#endif
-