diff options
author | Jack Lloyd <[email protected]> | 2018-11-06 14:14:30 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-11-06 14:14:30 -0500 |
commit | 4a9faab05d4c04d7aeaa1e7959d2bc488dd43d95 (patch) | |
tree | dc3fafd57e20a2f0f7a300712c75f6d9932a896c /src | |
parent | a4ef1c5368ce2e756124328468f02ba4a7b1722b (diff) |
Simplify BigInt::is_zero
The definition of return value of sig_words() means the integer is
zero iff sig_words() returns zero, so there is no reason to scan
over the data twice.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/math/bigint/bigint.h | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 8a434e6bb..aa2701fa4 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -361,12 +361,7 @@ class BOTAN_PUBLIC_API(2,0) BigInt final */ bool is_zero() const { - const size_t sw = sig_words(); - - for(size_t i = 0; i != sw; ++i) - if(m_reg[i]) - return false; - return true; + return (sig_words() == 0); } /** |