diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-02-21 03:56:12 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-02-21 03:56:12 +0000 |
commit | f31c784f2774311d1f7194ac4ca86262197a8099 (patch) | |
tree | 2bc784f8f9ef8d0a871c6a55566848227cfc7eab /include | |
parent | 385f7547b9755997b8bd918c2a4e2fc39d7d0207 (diff) | |
download | external_llvm-f31c784f2774311d1f7194ac4ca86262197a8099.zip external_llvm-f31c784f2774311d1f7194ac4ca86262197a8099.tar.gz external_llvm-f31c784f2774311d1f7194ac4ca86262197a8099.tar.bz2 |
Add a dump() method for debugging.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/APInt.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index f5e6df6..df16722 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -128,12 +128,17 @@ public: void fromString(uint32_t numBits, const char *StrStart, uint32_t slen, uint8_t radix); +#ifndef NDEBUG + /// @brief debug method + void dump() const; +#endif + +public: /// @brief An internal division function for dividing APInts. static void divide(const APInt LHS, uint32_t lhsWords, const APInt &RHS, uint32_t rhsWords, APInt *Quotient, APInt *Remainder); -public: /// @brief Create a new APInt of numBits bit-width, and initialized as val. APInt(uint32_t numBits, uint64_t val); @@ -412,7 +417,7 @@ public: /// computations to see how "wide" the value is. /// @brief Compute the number of active bits in the value inline uint32_t getActiveBits() const { - return getNumWords() * APINT_BITS_PER_WORD - countLeadingZeros(); + return BitWidth - countLeadingZeros(); } /// @returns a uint64_t value from this APInt. If this APInt contains a single |