aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/mp/mp_karat.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-11-15 14:35:19 +0000
committerlloyd <[email protected]>2014-11-15 14:35:19 +0000
commit1518c30f1c90c2d0e5e06731e3dffe21353b34db (patch)
treec2f819f2a2011a7af6052ede3b32638412b546d0 /src/lib/math/mp/mp_karat.cpp
parent17349a1fc49d604f8160f2077538fdf397b702c6 (diff)
Add specialized reduction for P-521 along with 9x9 Comba routines.
Roughly 35-50% faster on my laptop (depending on if mlock is enabled, the overhead in that allocator is becoming much more of a hotspot).
Diffstat (limited to 'src/lib/math/mp/mp_karat.cpp')
-rw-r--r--src/lib/math/mp/mp_karat.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/math/mp/mp_karat.cpp b/src/lib/math/mp/mp_karat.cpp
index b549a05c8..62620f83d 100644
--- a/src/lib/math/mp/mp_karat.cpp
+++ b/src/lib/math/mp/mp_karat.cpp
@@ -237,6 +237,11 @@ void bigint_mul(word z[], size_t z_size, word workspace[],
{
bigint_comba_mul8(z, x, y);
}
+ else if(x_sw <= 9 && x_size >= 9 &&
+ y_sw <= 9 && y_size >= 9 && z_size >= 18)
+ {
+ bigint_comba_mul9(z, x, y);
+ }
else if(x_sw <= 16 && x_size >= 16 &&
y_sw <= 16 && y_size >= 16 && z_size >= 32)
{
@@ -281,6 +286,10 @@ void bigint_sqr(word z[], size_t z_size, word workspace[],
{
bigint_comba_sqr8(z, x);
}
+ else if(x_sw == 9 && x_size >= 9 && z_size >= 18)
+ {
+ bigint_comba_sqr9(z, x);
+ }
else if(x_sw <= 16 && x_size >= 16 && z_size >= 32)
{
bigint_comba_sqr16(z, x);