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/bigint/bigint.h | |
parent | ddb9808ef59168174e8299b02fea4e84ac2742e3 (diff) |
Use resize instead of shrink_to_fit
Avoid recalculating significant words which slows down reduction
Diffstat (limited to 'src/lib/math/bigint/bigint.h')
-rw-r--r-- | src/lib/math/bigint/bigint.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h index 530fd5ecf..bd63425fd 100644 --- a/src/lib/math/bigint/bigint.h +++ b/src/lib/math/bigint/bigint.h @@ -570,6 +570,8 @@ class BOTAN_PUBLIC_API(2,0) BigInt final m_data.shrink_to_fit(min_size); } + void resize(size_t s) { m_data.resize(s); } + /** * Fill BigInt with a random number with size of bitsize * @@ -910,6 +912,11 @@ class BOTAN_PUBLIC_API(2,0) BigInt final m_reg.resize(words); } + void resize(size_t s) + { + m_reg.resize(s); + } + void swap(Data& other) { m_reg.swap(other.m_reg); |