diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-16 13:04:26 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-16 13:04:26 (GMT) |
commit | 2adcff3e5ba6e09366ef4208ab81768803ba15bd (patch) | |
tree | 963ed4c25de0f3f0b60d2392c5fd0e7441e548e5 /libtommath/bn_fast_mp_montgomery_reduce.c | |
parent | fac003f85aeba679d1cc6bea4eb8a84fc0ebd9f0 (diff) | |
download | tcl-2adcff3e5ba6e09366ef4208ab81768803ba15bd.zip tcl-2adcff3e5ba6e09366ef4208ab81768803ba15bd.tar.gz tcl-2adcff3e5ba6e09366ef4208ab81768803ba15bd.tar.bz2 |
import libtommath 1.0
Diffstat (limited to 'libtommath/bn_fast_mp_montgomery_reduce.c')
-rw-r--r-- | libtommath/bn_fast_mp_montgomery_reduce.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index 1a81689..a63839d 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -1,4 +1,4 @@ -#include <tommath.h> +#include <tommath_private.h> #ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C /* LibTomMath, multiple-precision integer library -- Tom St Denis * @@ -12,7 +12,7 @@ * The library is free for all purposes without any express * guarantee it works. * - * Tom St Denis, tomstdenis@gmail.com, http://libtom.org + * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ /* computes xR**-1 == x (mod N) via Montgomery Reduction @@ -32,7 +32,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) olduse = x->used; /* grow a as required */ - if (x->alloc < n->used + 1) { + if (x->alloc < (n->used + 1)) { if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { return res; } @@ -42,8 +42,8 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) * an array of double precision words W[...] */ { - register mp_word *_W; - register mp_digit *tmpx; + mp_word *_W; + mp_digit *tmpx; /* alias for the W[] array */ _W = W; @@ -57,7 +57,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } /* zero the high words of W[a->used..m->used*2] */ - for (; ix < n->used * 2 + 1; ix++) { + for (; ix < ((n->used * 2) + 1); ix++) { *_W++ = 0; } } @@ -72,7 +72,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) * by casting the value down to a mp_digit. Note this requires * that W[ix-1] have the carry cleared (see after the inner loop) */ - register mp_digit mu; + mp_digit mu; mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); /* a = a + mu * m * b**i @@ -90,9 +90,9 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) * first m->used words of W[] have the carries fixed */ { - register int iy; - register mp_digit *tmpn; - register mp_word *_W; + int iy; + mp_digit *tmpn; + mp_word *_W; /* alias for the digits of the modulus */ tmpn = n->dp; @@ -115,8 +115,8 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) * significant digits we zeroed]. */ { - register mp_digit *tmpx; - register mp_word *_W, *_W1; + mp_digit *tmpx; + mp_word *_W, *_W1; /* nox fix rest of carries */ @@ -126,7 +126,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) /* alias for next word, where the carry goes */ _W = W + ++ix; - for (; ix <= n->used * 2 + 1; ix++) { + for (; ix <= ((n->used * 2) + 1); ix++) { *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); } @@ -143,7 +143,7 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) /* alias for shifted double precision result */ _W = W + n->used; - for (ix = 0; ix < n->used + 1; ix++) { + for (ix = 0; ix < (n->used + 1); ix++) { *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); } @@ -168,5 +168,5 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) #endif /* $Source$ */ -/* $Revision: 0.41 $ */ -/* $Date: 2007-04-18 09:58:18 +0000 $ */ +/* $Revision$ */ +/* $Date$ */ |