aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-13 19:43:10 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-13 19:43:10 +0000
commit17893a5fb6b3b4b9e84674dfb7692abb57410dd1 (patch)
tree7a6eadff52ff928c62ceb09de6dccbc8158afe76 /include
parent48c7fa21a3b5e491bdf0ffc41fe7aa9687450c5f (diff)
downloadexternal_llvm-17893a5fb6b3b4b9e84674dfb7692abb57410dd1.zip
external_llvm-17893a5fb6b3b4b9e84674dfb7692abb57410dd1.tar.gz
external_llvm-17893a5fb6b3b4b9e84674dfb7692abb57410dd1.tar.bz2
Add a static APInt::getNumWords
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/APInt.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index 388316d..8c7c260 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -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;
}