aboutsummaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-06-19 14:01:54 +0000
committerlloyd <[email protected]>2012-06-19 14:01:54 +0000
commit50e5fa86a27603e463e7e70c1e76f4fe0215e022 (patch)
tree77b6de31fd3ee4cb6bbf832f4aa306ec9eca9d04 /src/math
parent9d65cb180326ed3009529695da170f3e23c71d0f (diff)
Remove BOTAN_MEM_POOL_CHUNK_SIZE macro from build.h, no longer used.
Move Karatsuba cutoffs to mp_karat.cpp as that is the only place that uses them and I doubt these get tweaked much (ever).
Diffstat (limited to 'src/math')
-rw-r--r--src/math/mp/mp_karat.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/math/mp/mp_karat.cpp b/src/math/mp/mp_karat.cpp
index 9bee7c42d..6d9adb4bf 100644
--- a/src/math/mp/mp_karat.cpp
+++ b/src/math/mp/mp_karat.cpp
@@ -13,13 +13,16 @@ namespace Botan {
namespace {
+static const size_t KARATSUBA_MULTIPLY_THRESHOLD = 32;
+static const size_t KARATSUBA_SQUARE_THRESHOLD = 32;
+
/*
* Karatsuba Multiplication Operation
*/
void karatsuba_mul(word z[], const word x[], const word y[], size_t N,
word workspace[])
{
- if(N < BOTAN_KARAT_MUL_THRESHOLD || N % 2)
+ if(N < KARATSUBA_MULTIPLY_THRESHOLD || N % 2)
{
if(N == 6)
return bigint_comba_mul6(z, x, y);
@@ -80,7 +83,7 @@ void karatsuba_mul(word z[], const word x[], const word y[], size_t N,
*/
void karatsuba_sqr(word z[], const word x[], size_t N, word workspace[])
{
- if(N < BOTAN_KARAT_SQR_THRESHOLD || N % 2)
+ if(N < KARATSUBA_SQUARE_THRESHOLD || N % 2)
{
if(N == 6)
return bigint_comba_sqr6(z, x);
@@ -239,8 +242,8 @@ void bigint_mul(word z[], size_t z_size, word workspace[],
{
bigint_comba_mul16(z, x, y);
}
- else if(x_sw < BOTAN_KARAT_MUL_THRESHOLD ||
- y_sw < BOTAN_KARAT_MUL_THRESHOLD ||
+ else if(x_sw < KARATSUBA_MULTIPLY_THRESHOLD ||
+ y_sw < KARATSUBA_MULTIPLY_THRESHOLD ||
!workspace)
{
bigint_simple_mul(z, x, x_sw, y, y_sw);
@@ -285,7 +288,7 @@ void bigint_sqr(word z[], size_t z_size, word workspace[],
{
bigint_comba_sqr16(z, x);
}
- else if(x_size < BOTAN_KARAT_SQR_THRESHOLD || !workspace)
+ else if(x_size < KARATSUBA_SQUARE_THRESHOLD || !workspace)
{
bigint_simple_sqr(z, x, x_sw);
}