aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-29 09:01:19 -0500
committerJack Lloyd <[email protected]>2018-12-29 09:01:19 -0500
commite761240ba5d46e8ab14b431a3421931ceb74663c (patch)
treecd98b01e9fbecb60eabd2d2d0fbc3d3b4aa316b9 /src
parent1d1f9a91a4f4805abda9590ee552ef6bb000b259 (diff)
Simplifications in BigInt
Use ct_is_zero instead of more complicated construction, and avoid duplicated size check/resize - Data::set_word will handle it.
Diffstat (limited to 'src')
-rw-r--r--src/lib/math/bigint/bigint.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp
index 065c469b4..d2551a991 100644
--- a/src/lib/math/bigint/bigint.cpp
+++ b/src/lib/math/bigint/bigint.cpp
@@ -188,7 +188,7 @@ size_t BigInt::Data::calc_sig_words() const
for(size_t i = 0; i != sz; ++i)
{
const word w = m_reg[sz - i - 1];
- sub &= CT::Mask<word>::is_zero(w).value();
+ sub &= ct_is_zero(w);
sig -= sub;
}
@@ -245,12 +245,6 @@ uint32_t BigInt::to_u32bit() const
void BigInt::conditionally_set_bit(size_t n, bool set_it)
{
const size_t which = n / BOTAN_MP_WORD_BITS;
-
- if(which >= size())
- {
- grow_to(which + 1);
- }
-
const word mask = static_cast<word>(set_it) << (n % BOTAN_MP_WORD_BITS);
m_data.set_word_at(which, word_at(which) | mask);
}