Add a static APInt::getNumWords
authorDouglas Gregor <dgregor@apple.com>
Mon, 13 Apr 2009 19:43:10 +0000 (19:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 13 Apr 2009 19:43:10 +0000 (19:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68977 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APInt.h

index 388316d20994c82692148e44f6b3fcdaab8b8e82..8c7c2605c51f630ac3e6b559b3e7a25d1eb296f5 100644 (file)
@@ -1000,6 +1000,14 @@ public:
   /// @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;
   }