aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-05 21:45:06 -0500
committerJack Lloyd <[email protected]>2018-12-05 21:45:06 -0500
commit6b22107d40dcd385d42d8ea1adfd1efa0b62626d (patch)
treea4df748d51e3add335e7e7d16b53cff4ac9c8f2b
parent7df693d6208fd499fea5d6748a7fff377851a3ce (diff)
Avoid needless is_zero check in set_sign
If not negative we don't need to check the size
-rw-r--r--src/lib/math/bigint/bigint.h8
1 files changed, 4 insertions, 4 deletions
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;
}
/**