diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-28 20:59:03 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-28 20:59:03 (GMT) |
commit | abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6 (patch) | |
tree | f7fcce47ca0f81f1eb0ec24efb9e34025ae158eb /libtommath/tommath_private.h | |
parent | d74f47cb2ad9e4fa4b038c1a2205f3e8becc2af0 (diff) | |
download | tcl-abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6.zip tcl-abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6.tar.gz tcl-abf9722f425fcd4a8327dddaf5c5ccf08b1d30d6.tar.bz2 |
Turn KARATSUBA_MUL_CUTOFF (insize libtommath) et al into a #define in stead of exported int symbols.
Diffstat (limited to 'libtommath/tommath_private.h')
-rw-r--r-- | libtommath/tommath_private.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 8fc3442..2096f77 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -42,15 +42,22 @@ extern "C" { # define XMALLOC malloc # define XFREE free # define XREALLOC realloc -# define XCALLOC calloc #elif 0 /* prototypes for our heap functions */ extern void *XMALLOC(size_t n); extern void *XREALLOC(void *p, size_t n); -extern void *XCALLOC(size_t n, size_t s); extern void XFREE(void *p); #endif +/* you'll have to tune these... */ +#define KARATSUBA_MUL_CUTOFF 80 /* Min. number of digits before Karatsuba multiplication is used. */ +#define KARATSUBA_SQR_CUTOFF 120 /* Min. number of digits before Karatsuba squaring is used. */ +#define TOOM_MUL_CUTOFF 350 /* no optimal values of these are known yet so set em high */ +#define TOOM_SQR_CUTOFF 400 + +/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */ +#define MP_WARRAY (1u << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) + 1)) + /* lowlevel functions, do not call! */ int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); |