diff options
-rw-r--r-- | src/lib/math/bigint/bigint.cpp | 29 | ||||
-rw-r--r-- | src/lib/math/bigint/bigint.h | 20 |
2 files changed, 17 insertions, 32 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp index ec0df8f2d..c21ce89fc 100644 --- a/src/lib/math/bigint/bigint.cpp +++ b/src/lib/math/bigint/bigint.cpp @@ -214,35 +214,6 @@ size_t BigInt::encoded_size(Base base) const } /* -* Set the sign -*/ -void BigInt::set_sign(Sign s) - { - if(is_zero()) - m_signedness = Positive; - else - m_signedness = s; - } - -/* -* Reverse the value of the sign flag -*/ -void BigInt::flip_sign() - { - set_sign(reverse_sign()); - } - -/* -* Return the opposite value of the current sign -*/ -BigInt::Sign BigInt::reverse_sign() const - { - if(sign() == Positive) - return Negative; - return Positive; - } - -/* * Return the negation of this number */ BigInt BigInt::operator-() const diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 6e2f8dbde..5092187d9 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -409,18 +409,32 @@ class BOTAN_PUBLIC_API(2,0) BigInt final /** * @result the opposite sign of the represented integer value */ - Sign reverse_sign() const; + Sign reverse_sign() const + { + if(sign() == Positive) + return Negative; + return Positive; + } /** * Flip the sign of this BigInt */ - void flip_sign(); + void flip_sign() + { + set_sign(reverse_sign()); + } /** * Set sign of the integer * @param sign new Sign to set */ - void set_sign(Sign sign); + void set_sign(Sign sign) + { + if(is_zero()) + m_signedness = Positive; + else + m_signedness = sign; + } /** * @result absolute (positive) value of this |