forked from OSchip/llvm-project
Add an isNegative method to determine if the APInt's value is negative.
This is much less expensive than a test against zero. llvm-svn: 34619
This commit is contained in:
parent
44eef169fa
commit
5aa8560eab
|
@ -352,6 +352,13 @@ public:
|
|||
return !slt(RHS);
|
||||
}
|
||||
|
||||
/// This just tests the high bit of this APInt to determine if it is negative.
|
||||
/// @returns true if this APInt is negative, false otherwise
|
||||
/// @brief Determine sign of this APInt.
|
||||
bool isNegative() {
|
||||
return (*this)[BitWidth - 1];
|
||||
}
|
||||
|
||||
/// Arithmetic right-shift this APInt by shiftAmt.
|
||||
/// @brief Arithmetic right-shift function.
|
||||
APInt ashr(uint32_t shiftAmt) const;
|
||||
|
|
Loading…
Reference in New Issue