summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-03-04 23:33:19 +0000
committerChris Lattner <sabre@nondot.org>2007-03-04 23:33:19 +0000
commit2fbcc0714c505fa6573709e987489cb6f698ab61 (patch)
tree90b34e487fff89fe7ed435a0f4592018cb797bd6
parente824f085c89b1b38e8a69c24cb151a25ecf284f0 (diff)
downloadbcm5719-llvm-2fbcc0714c505fa6573709e987489cb6f698ab61.tar.gz
bcm5719-llvm-2fbcc0714c505fa6573709e987489cb6f698ab61.zip
add a getSignBit method, elimiante virtual method from getBitMask()
llvm-svn: 34916
-rw-r--r--llvm/include/llvm/DerivedTypes.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/include/llvm/DerivedTypes.h b/llvm/include/llvm/DerivedTypes.h
index 29d7ede8232..dadbdcc3add 100644
--- a/llvm/include/llvm/DerivedTypes.h
+++ b/llvm/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.
OpenPOWER on IntegriCloud