diff options
author | Jack Lloyd <[email protected]> | 2018-11-09 12:53:44 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-11-09 12:53:44 -0500 |
commit | 86f3dc55a652ccc4653d4617ea5a50e63bc818c7 (patch) | |
tree | deacfbbd54d146ad2b874fbcc945e4ffd4dd9672 /src/lib/math/numbertheory/nistp_redc.cpp | |
parent | ddb9808ef59168174e8299b02fea4e84ac2742e3 (diff) |
Use resize instead of shrink_to_fit
Avoid recalculating significant words which slows down reduction
Diffstat (limited to 'src/lib/math/numbertheory/nistp_redc.cpp')
-rw-r--r-- | src/lib/math/numbertheory/nistp_redc.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/math/numbertheory/nistp_redc.cpp b/src/lib/math/numbertheory/nistp_redc.cpp index abec38d75..5ad4515b4 100644 --- a/src/lib/math/numbertheory/nistp_redc.cpp +++ b/src/lib/math/numbertheory/nistp_redc.cpp @@ -247,7 +247,7 @@ void redc_p224(BigInt& x, secure_vector<word>& ws) const int64_t S6 = 0xFFFFFFFF + X06 + X10 - X13; x.mask_bits(224); - x.shrink_to_fit(p224_limbs + 1); + x.resize(p224_limbs + 1); int64_t S = 0; uint32_t R0 = 0, R1 = 0; @@ -358,7 +358,7 @@ void redc_p256(BigInt& x, secure_vector<word>& ws) const int64_t S7 = 0xFFFFFFFA + X07 + X15*3 + X08 - X10 - X11 - X12 - X13; x.mask_bits(256); - x.shrink_to_fit(p256_limbs + 1); + x.resize(p256_limbs + 1); int64_t S = 0; @@ -505,7 +505,7 @@ void redc_p384(BigInt& x, secure_vector<word>& ws) const int64_t SB = 0xFFFFFFFF + X11 + X19 + X20 + X23 - X22; x.mask_bits(384); - x.shrink_to_fit(p384_limbs + 1); + x.resize(p384_limbs + 1); int64_t S = 0; |