aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-05-09 18:06:03 -0400
committerJack Lloyd <[email protected]>2018-05-09 18:06:03 -0400
commitdcc2a6161ab4f6da160cd0705fa10117e35fb6e0 (patch)
tree037312c0033d0a3d353dbc9a1128c727b93f3930 /src
parent1fffb3b18f039ca4ce87bbb2974242bf0aba2319 (diff)
Inline BigInt::shrink_to_fit
Improves P-256 a bit
Diffstat (limited to 'src')
-rw-r--r--src/lib/math/bigint/bigint.cpp6
-rw-r--r--src/lib/math/bigint/bigint.h6
2 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/math/bigint/bigint.cpp b/src/lib/math/bigint/bigint.cpp
index 39cff666c..495907d1a 100644
--- a/src/lib/math/bigint/bigint.cpp
+++ b/src/lib/math/bigint/bigint.cpp
@@ -341,12 +341,6 @@ void BigInt::binary_decode(const uint8_t buf[], size_t length)
m_reg[length / WORD_BYTES] = (m_reg[length / WORD_BYTES] << 8) | buf[i];
}
-void BigInt::shrink_to_fit(size_t min_size)
- {
- const size_t words = std::max(min_size, sig_words());
- m_reg.resize(words);
- }
-
#if defined(BOTAN_HAS_VALGRIND)
void BigInt::const_time_poison() const
{
diff --git a/src/lib/math/bigint/bigint.h b/src/lib/math/bigint/bigint.h
index d5bd4ad4f..64ab24e7d 100644
--- a/src/lib/math/bigint/bigint.h
+++ b/src/lib/math/bigint/bigint.h
@@ -552,7 +552,11 @@ class BOTAN_PUBLIC_API(2,0) BigInt final
* Resize the vector to the minimum word size to hold the integer, or
* min_size words, whichever is larger
*/
- void shrink_to_fit(size_t min_size = 0);
+ void shrink_to_fit(size_t min_size = 0)
+ {
+ const size_t words = std::max(min_size, sig_words());
+ m_reg.resize(words);
+ }
/**
* Fill BigInt with a random number with size of bitsize