From 6b22107d40dcd385d42d8ea1adfd1efa0b62626d Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 5 Dec 2018 21:45:06 -0500 Subject: Avoid needless is_zero check in set_sign If not negative we don't need to check the size --- src/lib/math/bigint/bigint.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 9b7af4169..ee8f81719 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -553,10 +553,10 @@ class BOTAN_PUBLIC_API(2,0) BigInt final */ void set_sign(Sign sign) { - if(is_zero()) - m_signedness = Positive; - else - m_signedness = sign; + if(sign == Negative && is_zero()) + sign = Positive; + + m_signedness = sign; } /** -- cgit v1.2.3