diff options
author | Chris Lattner <sabre@nondot.org> | 2007-03-04 23:33:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-03-04 23:33:19 +0000 |
commit | f298fd0428e3e26fda13d24bb7295c416a9b8452 (patch) | |
tree | 011a7ba5dec69d5be119ed1b85c57c2f4e2c635e | |
parent | 82a60eca8fb5761817960e75fd469246496f8dce (diff) | |
download | llvm-f298fd0428e3e26fda13d24bb7295c416a9b8452.tar.gz llvm-f298fd0428e3e26fda13d24bb7295c416a9b8452.tar.bz2 llvm-f298fd0428e3e26fda13d24bb7295c416a9b8452.tar.xz |
add a getSignBit method, elimiante virtual method from getBitMask()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34916 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/DerivedTypes.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 29d7ede823..dadbdcc3ad 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -106,9 +106,15 @@ public: /// that can be set by an unsigned version of this type. This is 0xFF for /// sbyte/ubyte, 0xFFFF for shorts, etc. uint64_t getBitMask() const { - return ~uint64_t(0UL) >> (64-getPrimitiveSizeInBits()); + return ~uint64_t(0UL) >> (64-getBitWidth()); } + /// getSignBit - Return a uint64_t with just the most significant bit set (the + /// sign bit, if the value is treated as a signed number). + uint64_t getSignBit() const { + return 1ULL << (getBitWidth()-1); + } + /// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc. /// @returns a bit mask with ones set for all the bits of this type. /// @brief Get a bit mask for this type. |