mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
Add an abs() function to get the absolute value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34819 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
295e40aa5c
commit
b45a221348
@ -759,6 +759,14 @@ public:
|
||||
|
||||
/// @brief Compute the square root
|
||||
APInt sqrt() const;
|
||||
|
||||
/// If *this is < 0 then return -(*this), otherwise *this;
|
||||
/// @brief Get the absolute value;
|
||||
APInt abs() const {
|
||||
if (isNegative())
|
||||
return -(*this);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(uint64_t V1, const APInt& V2) {
|
||||
|
Loading…
Reference in New Issue
Block a user