[llvm-commits] [llvm] r68977 - /llvm/trunk/include/llvm/ADT/APInt.h

Douglas Gregor dgregor at apple.com
Mon Apr 13 12:43:10 PDT 2009


Author: dgregor
Date: Mon Apr 13 14:43:10 2009
New Revision: 68977

URL: http://llvm.org/viewvc/llvm-project?rev=68977&view=rev
Log:
Add a static APInt::getNumWords

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=68977&r1=68976&r2=68977&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Mon Apr 13 14:43:10 2009
@@ -1000,6 +1000,14 @@
   /// @returns the number of words to hold the integer value of this APInt.
   /// @brief Get the number of words.
   unsigned getNumWords() const {
+    return getNumWords(BitWidth);
+  }
+
+  /// Here one word's bitwidth equals to that of uint64_t.
+  /// @returns the number of words to hold the integer value with a
+  /// given bit width.
+  /// @brief Get the number of words.
+  static unsigned getNumWords(unsigned BitWidth) {
     return (BitWidth + APINT_BITS_PER_WORD - 1) / APINT_BITS_PER_WORD;
   }
 





More information about the llvm-commits mailing list