summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-28 21:48:06 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-28 21:48:06 +0000
commit8d01d5da78d9cd672ff0bfc431a149bc12560355 (patch)
tree4f3f5b6e609f3c34918555df9c09dfb3100c0ca2
parent72235d084dceac9126d793bb0bd8c1a07a050f16 (diff)
downloadbcm5719-llvm-8d01d5da78d9cd672ff0bfc431a149bc12560355.tar.gz
bcm5719-llvm-8d01d5da78d9cd672ff0bfc431a149bc12560355.zip
[APInt] Add an isNullValue method to check for all bits being zero. Use it in a couple internal methods where it makes more sense than isMinValue or !getBoolValue. NFC
I used Null rather than Zero to match the getNullValue method name. There are some other places outside APInt where isNullValue would be more readable than isMinValue even though they do the same thing. I'll update those in future patches. llvm-svn: 301695
-rw-r--r--llvm/include/llvm/ADT/APInt.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 0338beec7ff..0f82654a88f 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -366,7 +366,7 @@ public:
/// that 0 is not a positive value.
///
/// \returns true if this APInt is positive.
- bool isStrictlyPositive() const { return isNonNegative() && !!*this; }
+ bool isStrictlyPositive() const { return isNonNegative() && !isNullValue(); }
/// \brief Determine if all bits are set
///
@@ -377,6 +377,11 @@ public:
return countPopulationSlowCase() == BitWidth;
}
+ /// \brief Determine if all bits are set
+ ///
+ /// This checks to see if the value has all bits of the APInt are set or not.
+ bool isNullValue() const { return !*this; }
+
/// \brief Determine if this is the largest unsigned value.
///
/// This checks to see if the value of this APInt is the maximum unsigned
@@ -395,7 +400,7 @@ public:
///
/// This checks to see if the value of this APInt is the minimum unsigned
/// value for the APInt's bit width.
- bool isMinValue() const { return !*this; }
+ bool isMinValue() const { return isNullValue(); }
/// \brief Determine if this is the smallest signed value.
///
@@ -1711,7 +1716,7 @@ public:
return VAL - 1;
// Handle the zero case.
- if (!getBoolValue())
+ if (isNullValue())
return UINT32_MAX;
// The non-zero case is handled by computing:
OpenPOWER on IntegriCloud