diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-08-11 00:37:34 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2021-08-11 20:59:54 +0200 |
| commit | 2b274fefbb214533399b804acce8977ecaa3afeb (patch) | |
| tree | fb994e586fba8b29886977f0dbf5a1afe0b9f132 /core/math/big/internal.odin | |
| parent | 6c681b258c7118b4a6aa7bf27af38f5556ad7599 (diff) | |
big: Add `_private_int_sqr_karatsuba`.
Diffstat (limited to 'core/math/big/internal.odin')
| -rw-r--r-- | core/math/big/internal.odin | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/math/big/internal.odin b/core/math/big/internal.odin index 9b267176d..00b1ed7bf 100644 --- a/core/math/big/internal.odin +++ b/core/math/big/internal.odin @@ -36,7 +36,7 @@ import "core:mem" import "core:intrinsics" import rnd "core:math/rand" -//import "core:fmt" +// import "core:fmt" /* Low-level addition, unsigned. Handbook of Applied Cryptography, algorithm 14.7. @@ -627,20 +627,22 @@ internal_int_mul :: proc(dest, src, multiplier: ^Int, allocator := context.alloc Do we need to square? */ if src.used >= SQR_TOOM_CUTOFF { - /* Use Toom-Cook? */ - // err = s_mp_sqr_toom(a, c); + /* + Use Toom-Cook? + */ // fmt.printf("_private_int_sqr_toom: %v\n", src.used); - err = #force_inline _private_int_sqr(dest, src); + err = #force_inline _private_int_sqr_karatsuba(dest, src); } else if src.used >= SQR_KARATSUBA_CUTOFF { - /* Karatsuba? */ - // err = s_mp_sqr_karatsuba(a, c); - // fmt.printf("_private_int_sqr_karatsuba: %v\n", src.used); - err = #force_inline _private_int_sqr(dest, src); + /* + Karatsuba? + */ + err = #force_inline _private_int_sqr_karatsuba(dest, src); } else if ((src.used * 2) + 1) < _WARRAY && src.used < (_MAX_COMBA / 2) { /* Fast comba? */ err = #force_inline _private_int_sqr_comba(dest, src); + //err = #force_inline _private_int_sqr(dest, src); } else { err = #force_inline _private_int_sqr(dest, src); } |