correct bug I introduced into invert.c

This commit is contained in:
gladman 2009-12-09 20:30:32 +00:00
parent aaf7949430
commit 73dccb229b

View File

@ -33,10 +33,8 @@ MA 02110-1301, USA. */
#define ONE (mp_limb_t) 1 #define ONE (mp_limb_t) 1
#define WRAP_AROUND_BOUND 1500 #define WRAP_AROUND_BOUND 1500
#ifndef _MSC_VER static int
is_invert (mp_ptr xp, mp_srcptr ap, mp_size_t n)
int
test_invert (mp_ptr xp, mp_srcptr ap, mp_size_t n)
{ {
int res = 1; int res = 1;
mp_size_t i; mp_size_t i;
@ -64,8 +62,6 @@ test_invert (mp_ptr xp, mp_srcptr ap, mp_size_t n)
return res; return res;
} }
#endif
/* Input: A = {ap, n} with most significant bit set. /* Input: A = {ap, n} with most significant bit set.
Output: X = B^n + {xp, n} where B = 2^GMP_NUMB_BITS. Output: X = B^n + {xp, n} where B = 2^GMP_NUMB_BITS.
@ -214,7 +210,7 @@ mpn_invert (mp_ptr xp, mp_srcptr ap, mp_size_t n)
MPN_COPY (xp, up + 2 * h - l, l); MPN_COPY (xp, up + 2 * h - l, l);
mpn_add_1 (xp + l, xp + l, h, cy); mpn_add_1 (xp + l, xp + l, h, cy);
TMP_FREE; TMP_FREE;
if ((special) && !test_invert(xp, ap, n)) if ((special) && !is_invert(xp, ap, n))
mpn_add_1 (xp, xp, n, 1); mpn_add_1 (xp, xp, n, 1);
} }
} }