diff options
author | Torbjorn Granlund <tege@gmplib.org> | 2010-05-07 00:41:24 +0200 |
---|---|---|
committer | Torbjorn Granlund <tege@gmplib.org> | 2010-05-07 00:41:24 +0200 |
commit | 66c3ec7eba4eb10589276e977425fa5a9fe347b7 (patch) | |
tree | 90a988d2ddb86b31a67f4231a4236518a0638968 | |
parent | 204bc54967df4b982fa8731a4f5a2f89094bcbf0 (diff) | |
download | gmp-66c3ec7eba4eb10589276e977425fa5a9fe347b7.tar.gz |
Clean up some spacing.
-rw-r--r-- | gen-jacobitab.c | 10 | ||||
-rw-r--r-- | gmp-impl.h | 6 | ||||
-rw-r--r-- | mpn/generic/gcd.c | 2 | ||||
-rw-r--r-- | mpn/generic/gcd_subdiv_step.c | 8 | ||||
-rw-r--r-- | mpn/generic/gcdext.c | 4 | ||||
-rw-r--r-- | mpn/generic/gcdext_lehmer.c | 14 | ||||
-rw-r--r-- | mpn/generic/jacbase.c | 22 | ||||
-rw-r--r-- | mpn/generic/jacobi_lehmer.c | 24 | ||||
-rw-r--r-- | mpn/pa32/gmp-mparam.h | 4 | ||||
-rw-r--r-- | mpn/powerpc64/mode64/invert_limb.asm | 2 | ||||
-rw-r--r-- | mpz/jacobi.c | 96 | ||||
-rw-r--r-- | tests/mpz/t-jac.c | 8 | ||||
-rw-r--r-- | tests/refmpz.c | 2 | ||||
-rw-r--r-- | tune/README | 2 |
14 files changed, 102 insertions, 102 deletions
diff --git a/gen-jacobitab.c b/gen-jacobitab.c index 261e5c074..5ff55999e 100644 --- a/gen-jacobitab.c +++ b/gen-jacobitab.c @@ -44,7 +44,7 @@ static const struct /* 10 */ { 3, 0 }, /* 11 */ { 3, 2 }, /* 12 */ { 3, 3 }, /* d = 0 */ - + }; #define JACOBI_A(bits) (decode_table[(bits)>>1].a) #define JACOBI_B(bits) (decode_table[(bits)>>1].b) @@ -56,7 +56,7 @@ static unsigned encode (unsigned a, unsigned b, unsigned d) { unsigned i; - + assert (d < 2); assert (a < 4); assert (b < 4); @@ -87,7 +87,7 @@ main (int argc, char **argv) q = bits & 3; d = (bits >> 2) & 1; - + e = JACOBI_E (bits >> 3); a = JACOBI_A (bits >> 3); b = JACOBI_B (bits >> 3); @@ -108,10 +108,10 @@ main (int argc, char **argv) e ^= (q & (b >> 1)) ^ (q >> 1); b = (b - q * a) & 3; } - + printf("%2d,", (encode (a, b, d) << 1) | e); } printf("\n"); - + return 0; } diff --git a/gmp-impl.h b/gmp-impl.h index 8561c7192..04adb3e67 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -2835,7 +2835,7 @@ __GMP_DECLSPEC mp_limb_t mpn_preinv_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp /* This selection may seem backwards. The reason mpn_mod_1 typically takes over for larger sizes is that it uses the mod_1_1 function. */ -#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \ +#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \ (BELOW_THRESHOLD (size, PREINV_MOD_1_TO_MOD_1_THRESHOLD) \ ? mpn_preinv_mod_1 (src, size, divisor, inverse) \ : mpn_mod_1 (src, size, divisor)) @@ -3770,7 +3770,7 @@ mpn_jacobi_update (unsigned bits, unsigned denominator, unsigned q) With constant denominator, the below table lookup is compiled to C Constant q = 1, constant denominator = 1 - movzbl table+5(%eax,8), %eax + movzbl table+5(%eax,8), %eax or @@ -3780,7 +3780,7 @@ mpn_jacobi_update (unsigned bits, unsigned denominator, unsigned q) One could maintain the state preshifted 3 bits, to save a shift here, but at least on x86, that's no real saving. */ - return bits = jacobi_table[(bits << 3) + (denominator << 2) + q]; + return bits = jacobi_table[(bits << 3) + (denominator << 2) + q]; } /* Matrix multiplication */ diff --git a/mpn/generic/gcd.c b/mpn/generic/gcd.c index 94ab21742..1f44f5059 100644 --- a/mpn/generic/gcd.c +++ b/mpn/generic/gcd.c @@ -65,7 +65,7 @@ gcd_hook (void *p, mp_srcptr gp, mp_size_t gn, MPN_COPY (ctx->gp, gp, gn); ctx->gn = gn; } - + #if GMP_NAIL_BITS > 0 /* Nail supports should be easy, replacing the sub_ddmmss with nails * logic. */ diff --git a/mpn/generic/gcd_subdiv_step.c b/mpn/generic/gcd_subdiv_step.c index 0a5c65bf6..00d32db10 100644 --- a/mpn/generic/gcd_subdiv_step.c +++ b/mpn/generic/gcd_subdiv_step.c @@ -45,9 +45,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ Otherwise, if d = 0 we have just subtracted a multiple of A from B, and if d = 1 we have subtracted a multiple of B from A. - + + If A == B after subtraction, G is the gcd, Q is NULL. - + + If we get a zero remainder after division, G is the gcd, Q is the quotient. @@ -117,9 +117,9 @@ mpn_gcd_subdiv_step (mp_ptr ap, mp_ptr bp, mp_size_t n, if (UNLIKELY (c == 0)) { hook (ctx, bp, bn, NULL, 0, swapped); - return 0; + return 0; } - + hook (ctx, NULL, 0, &one, 1, swapped); if (c > 0) diff --git a/mpn/generic/gcdext.c b/mpn/generic/gcdext.c index d314ab94c..cace9b488 100644 --- a/mpn/generic/gcdext.c +++ b/mpn/generic/gcdext.c @@ -276,7 +276,7 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep, ctx.gp = gp; ctx.up = up; ctx.usize = usizep; - + { /* For the first hgcd call, there are no u updates, and it makes some sense to use a different choice for p. */ @@ -370,7 +370,7 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep, ctx.u0 = u0; ctx.u1 = u1; ctx.tp = tp + n; /* ualloc */ - ctx.un = un; + ctx.un = un; /* Temporary storage n */ n = mpn_gcd_subdiv_step (ap, bp, n, mpn_gcdext_hook, &ctx, tp); diff --git a/mpn/generic/gcdext_lehmer.c b/mpn/generic/gcdext_lehmer.c index b7288c9c4..904f5cc08 100644 --- a/mpn/generic/gcdext_lehmer.c +++ b/mpn/generic/gcdext_lehmer.c @@ -37,11 +37,11 @@ mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn, MPN_COPY (ctx->gp, gp, gn); ctx->gn = gn; - + if (d < 0) { int c; - + /* Must return the smallest cofactor, +u1 or -u0 */ MPN_CMP (c, ctx->u0, ctx->u1, un); ASSERT (c != 0 || (un == 1 && ctx->u0[0] == 1 && ctx->u1[0] == 1)); @@ -63,10 +63,10 @@ mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn, mp_ptr u1 = ctx->u1; ASSERT (d >= 0); - + if (d) MP_PTR_SWAP (u0, u1); - + qn -= (qp[qn-1] == 0); /* Update u0 += q * u1 */ @@ -92,7 +92,7 @@ mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn, return; tp = ctx->tp; - + if (qn > u1n) mpn_mul (tp, qp, qn, u1, u1n); else @@ -105,7 +105,7 @@ mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn, cy = mpn_add (u0, tp, u1n, u0, un); else cy = mpn_add (u0, u0, un, tp, u1n); - + un = u1n; } u0[un] = cy; @@ -157,7 +157,7 @@ mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize, ctx.gp = gp; ctx.up = up; ctx.usize = usize; - + /* FIXME: Handle n == 2 differently, after the loop? */ while (n >= 2) { diff --git a/mpn/generic/jacbase.c b/mpn/generic/jacbase.c index 0ab4b48e3..00e85f538 100644 --- a/mpn/generic/jacbase.c +++ b/mpn/generic/jacbase.c @@ -72,15 +72,15 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define PROCESS_TWOS_EVEN \ { \ int two, mask, shift; \ - \ + \ two = JACOBI_TWO_U_BIT1 (b); \ mask = (~a & 2); \ a >>= 1; \ - \ + \ shift = (~a & 1); \ a >>= shift; \ result_bit1 ^= two ^ (two & mask); \ - \ + \ while ((a & 1) == 0) \ { \ a >>= 1; \ @@ -91,14 +91,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #define PROCESS_TWOS_ANY \ { \ int two, mask, shift; \ - \ + \ two = JACOBI_TWO_U_BIT1 (b); \ shift = (~a & 1); \ a >>= shift; \ - \ + \ mask = shift << 1; \ result_bit1 ^= (two & mask); \ - \ + \ while ((a & 1) == 0) \ { \ a >>= 1; \ @@ -139,7 +139,7 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int result_bit1) if (a >= b) goto a_gt_b; - + for (;;) { result_bit1 ^= JACOBI_RECIP_UU_BIT1 (a, b); @@ -200,7 +200,7 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int bit) a >>= c; a >>= 1; - do + do { mp_limb_t t = a - b; mp_limb_t bgta = LIMB_HIGHBIT_TO_MASK (t); @@ -210,7 +210,7 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int bit) /* If b > a, invoke reciprocity */ bit ^= (bgta & a & b); - + /* b <-- min (a, b) */ b += (bgta & t); @@ -224,9 +224,9 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int bit) /* (2/b) = -1 if b = 3 or 5 mod 8 */ bit ^= c & (b ^ (b >> 1)); a >>= c; - } + } while (b > 0); return 1-2*(bit & 1); -} +} #endif /* JACOBI_BASE_METHOD == 4 */ diff --git a/mpn/generic/jacobi_lehmer.c b/mpn/generic/jacobi_lehmer.c index ff53dac68..a1a907ba2 100644 --- a/mpn/generic/jacobi_lehmer.c +++ b/mpn/generic/jacobi_lehmer.c @@ -259,7 +259,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) if ( (bh | bl) == 0) return 1 - 2*(bit & 1); - + if ( (ah | al) == 0) return 0; @@ -271,7 +271,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) } count_trailing_zeros (c, al); bit ^= c & (bl ^ (bl >> 1)); - + c++; if (UNLIKELY (c == GMP_NUMB_BITS)) { @@ -332,7 +332,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) } ASSERT (bl > 0); - + while ( (al | bl) & GMP_LIMB_HIGHBIT) { /* Need an extra comparison to get the mask. */ @@ -344,7 +344,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) /* If b > a, invoke reciprocity */ bit ^= (bgta & al & bl); - + /* b <-- min (a, b) */ bl += (bgta & t); @@ -440,7 +440,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) { count_trailing_zeros (c, ah); bit ^= ((GMP_NUMB_BITS + c) << 1) & (bl ^ (bl >> 1)); - + al = bl; bl = ah >> c; ah = bh; @@ -455,7 +455,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) } if (ah == bh) goto cancel_hi; - + if (ah == 0) { bit ^= al & bl; @@ -463,7 +463,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) ah = bh; break; } - + bit ^= al & bl; /* Compute (b|a) */ @@ -537,7 +537,7 @@ mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit) al = ((ah << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (al >> c); ah >>= c; - bit ^= (c << 1) & (bl ^ (bl >> 1)); + bit ^= (c << 1) & (bl ^ (bl >> 1)); } ab_reduced: ASSERT (bl & 1); @@ -777,8 +777,8 @@ jacobi_hook (void *p, mp_srcptr gp, mp_size_t gn, *bitsp = BITS_FAIL; return; } - } - + } + if (qp) { ASSERT (qn > 0); @@ -841,13 +841,13 @@ mpn_jacobi_lehmer (mp_ptr ap, mp_ptr bp, mp_size_t n, unsigned bits, mp_ptr tp) if (bits >= 16) MP_PTR_SWAP (ap, bp); - + if (n == 1) { mp_limb_t al, bl; al = ap[0]; bl = bp[0]; - + if (bl == 1) return 1 - 2*(bits & 1); else diff --git a/mpn/pa32/gmp-mparam.h b/mpn/pa32/gmp-mparam.h index ca5ead0e3..8eb6a0fb0 100644 --- a/mpn/pa32/gmp-mparam.h +++ b/mpn/pa32/gmp-mparam.h @@ -24,14 +24,14 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ /* These values are for the PA7100 using GCC. */ /* Generated by tuneup.c, 2000-10-27. */ -#ifndef MUL_TOOM22_THRESHOLD +#ifndef MUL_TOOM22_THRESHOLD #define MUL_TOOM22_THRESHOLD 30 #endif #ifndef MUL_TOOM33_THRESHOLD #define MUL_TOOM33_THRESHOLD 141 #endif -#ifndef SQR_TOOM2_THRESHOLD +#ifndef SQR_TOOM2_THRESHOLD #define SQR_TOOM2_THRESHOLD 59 #endif #ifndef SQR_TOOM3_THRESHOLD diff --git a/mpn/powerpc64/mode64/invert_limb.asm b/mpn/powerpc64/mode64/invert_limb.asm index 4f3a5b504..aed0a32ab 100644 --- a/mpn/powerpc64/mode64/invert_limb.asm +++ b/mpn/powerpc64/mode64/invert_limb.asm @@ -58,7 +58,7 @@ PROLOGUE(mpn_invert_limb) subf r8, r11, r8 C ((v2 >> 1) & mask) - v2 * d63 mulhdu r0, r8, r0 C p1 = v2 * (((v2 >> 1) & mask) - v2 * d63) srdi r0, r0, 1 C p1 >> 1 - add r0, r0, r9 C v3 = (v2 << 31) + (p1 >> 1) + add r0, r0, r9 C v3 = (v2 << 31) + (p1 >> 1) nop mulhdu r9, r0, r3 mulld r11, r0, r3 diff --git a/mpz/jacobi.c b/mpz/jacobi.c index 3d467f8d3..48f6ec369 100644 --- a/mpz/jacobi.c +++ b/mpz/jacobi.c @@ -31,8 +31,8 @@ with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ do { \ if ((shift) != 0) \ { \ - ASSERT_NOCARRY (mpn_rshift (dst, src, size, shift)); \ - (size) -= ((dst)[(size)-1] == 0); \ + ASSERT_NOCARRY (mpn_rshift (dst, src, size, shift)); \ + (size) -= ((dst)[(size)-1] == 0); \ } \ else \ MPN_COPY (dst, src, size); \ @@ -43,7 +43,7 @@ with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ mpz_kronecker. For ABI compatibility, the link symbol is __gmpz_jacobi, not __gmpz_kronecker, even though the latter would be more logical. - + mpz_jacobi could assume b is odd, but the improvements from that seem small compared to other operations, and anything significant should be checked at run-time since we'd like odd b to go fast in mpz_kronecker @@ -98,19 +98,19 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) if ( (((alow | blow) & 1) == 0)) /* Common factor of 2 ==> (a/b) = 0 */ return 0; - + if (asize == 0) /* (0/b) = [ b = 1 or b = - 1 ] */ return ABS (bsize) == 1 && blow == 1; - /* (a/-1) = -1 if a < 0, +1 if a >= 0 */ + /* (a/-1) = -1 if a < 0, +1 if a >= 0 */ bits = (asize < 0) && (bsize < 0); bsize = ABS (bsize); /* (a/2) = -1 iff a = 3 or a = -3 mod 8 */ a3 = (alow >> 1) ^ (alow >> 2); - + while (blow == 0) { if (GMP_NUMB_BITS & 1) @@ -118,7 +118,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) bsize--; blow = *++bsrcp; } - + TMP_MARK; bp = TMP_ALLOC_LIMBS (bsize); if (blow & 1) @@ -141,7 +141,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) asize = ABS(asize); /* FIXME: Take out powers of two in a? */ - + bits = mpn_jacobi_init (alow, blow, bits & 1); if (asize > bsize) @@ -154,13 +154,13 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) scratch = TMP_ALLOC_LIMBS (itch); ap = TMP_ALLOC_LIMBS (bsize); - + mpn_tdiv_qr (scratch, ap, 0, asrcp, asize, bp, bsize); bits = mpn_jacobi_update (bits, 1, scratch[0] & 3); res = mpn_jacobi_lehmer (ap, bp, bsize, bits, scratch); } else if (asize < bsize) - { + { mp_size_t itch = 2*asize; mp_ptr scratch; @@ -203,8 +203,8 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) TMP_DECL; TRACE (printf ("start asize=%d bsize=%d\n", SIZ(a), SIZ(b)); - mpz_trace (" a", a); - mpz_trace (" b", b)); + mpz_trace (" a", a); + mpz_trace (" b", b)); asize = SIZ(a); asrcp = PTR(a); @@ -240,7 +240,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) { bsecond = bsrcp[1]; if (btwos != 0) - blow |= (bsecond << (GMP_NUMB_BITS - btwos)) & GMP_NUMB_MASK; + blow |= (bsecond << (GMP_NUMB_BITS - btwos)) & GMP_NUMB_MASK; } /* account for effect of sign of a, then ignore it */ @@ -255,11 +255,11 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) result_bit1 ^= JACOBI_TWOS_U_BIT1 (btwos, alow); if (blow == 1) /* (a/1)=1 always */ - return JACOBI_BIT1_TO_PN (result_bit1); + return JACOBI_BIT1_TO_PN (result_bit1); JACOBI_MOD_OR_MODEXACT_1_ODD (result_bit1, alow, asrcp, asize, blow); TRACE (printf ("base (%lu/%lu) with %d\n", - alow, blow, JACOBI_BIT1_TO_PN (result_bit1))); + alow, blow, JACOBI_BIT1_TO_PN (result_bit1))); return mpn_jacobi_base (alow, blow, result_bit1); } @@ -277,7 +277,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) { asecond = asrcp[1]; if (atwos != 0) - alow |= (asecond << (GMP_NUMB_BITS - atwos)) & GMP_NUMB_MASK; + alow |= (asecond << (GMP_NUMB_BITS - atwos)) & GMP_NUMB_MASK; } /* (a/2)=(2/a) with a odd */ @@ -288,7 +288,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) /* another special case with modexact and no copying */ if (alow == 1) /* (1/b)=1 always */ - return JACOBI_BIT1_TO_PN (result_bit1); + return JACOBI_BIT1_TO_PN (result_bit1); /* b still has its twos, so cancel out their effect */ result_bit1 ^= JACOBI_TWOS_U_BIT1 (btwos, alow); @@ -296,7 +296,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow); /* now (b/a) */ JACOBI_MOD_OR_MODEXACT_1_ODD (result_bit1, blow, bsrcp, bsize, alow); TRACE (printf ("base (%lu/%lu) with %d\n", - blow, alow, JACOBI_BIT1_TO_PN (result_bit1))); + blow, alow, JACOBI_BIT1_TO_PN (result_bit1))); return mpn_jacobi_base (blow, alow, result_bit1); } @@ -336,11 +336,11 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) MPN_NORMALIZE (ap, asize); TRACE (printf ("tdiv_qr asize=%ld bsize=%ld\n", asize, bsize); - mpn_trace (" a", ap, asize); - mpn_trace (" b", bp, bsize)); + mpn_trace (" a", ap, asize); + mpn_trace (" b", bp, bsize)); if (asize == 0) /* (0/b)=0 for b!=1 */ - goto zero; + goto zero; alow = ap[0]; goto strip_a; @@ -358,25 +358,25 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) ASSERT (blow & 1); TRACE (printf ("top asize=%ld bsize=%ld\n", asize, bsize); - mpn_trace (" a", ap, asize); - mpn_trace (" b", bp, bsize)); + mpn_trace (" a", ap, asize); + mpn_trace (" b", bp, bsize)); /* swap if necessary to make a>=b, applying reciprocity - high limbs are almost always enough to tell which is bigger */ + high limbs are almost always enough to tell which is bigger */ if (asize < bsize - || (asize == bsize - && ((ahigh=ap[asize-1]) < (bhigh=bp[asize-1]) - || (ahigh == bhigh - && mpn_cmp (ap, bp, asize-1) < 0)))) - { - TRACE (printf ("swap\n")); - MPN_PTR_SWAP (ap,asize, bp,bsize); - MP_LIMB_T_SWAP (alow, blow); - result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow); - } + || (asize == bsize + && ((ahigh=ap[asize-1]) < (bhigh=bp[asize-1]) + || (ahigh == bhigh + && mpn_cmp (ap, bp, asize-1) < 0)))) + { + TRACE (printf ("swap\n")); + MPN_PTR_SWAP (ap,asize, bp,bsize); + MP_LIMB_T_SWAP (alow, blow); + result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow); + } if (asize == 1) - break; + break; /* a = a-b */ ASSERT (asize >= bsize); @@ -385,25 +385,25 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) alow = ap[0]; /* (0/b)=0 for b!=1. b!=1 when a==0 because otherwise would have had - a==1 which is asize==1 and would have exited above. */ + a==1 which is asize==1 and would have exited above. */ if (asize == 0) - goto zero; + goto zero; strip_a: /* low zero limbs on a can be discarded */ JACOBI_STRIP_LOW_ZEROS (result_bit1, blow, ap, asize, alow); if ((alow & 1) == 0) - { - /* factors of 2 from a */ - unsigned twos; - count_trailing_zeros (twos, alow); - TRACE (printf ("twos %u\n", twos)); - result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, blow); - ASSERT_NOCARRY (mpn_rshift (ap, ap, asize, twos)); - asize -= (ap[asize-1] == 0); - alow = ap[0]; - } + { + /* factors of 2 from a */ + unsigned twos; + count_trailing_zeros (twos, alow); + TRACE (printf ("twos %u\n", twos)); + result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, blow); + ASSERT_NOCARRY (mpn_rshift (ap, ap, asize, twos)); + asize -= (ap[asize-1] == 0); + alow = ap[0]; + } } ASSERT (asize == 1 && bsize == 1); /* just alow and blow left */ @@ -416,7 +416,7 @@ mpz_jacobi (mpz_srcptr a, mpz_srcptr b) /* swap with reciprocity and do (b/a) */ result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow); TRACE (printf ("base (%lu/%lu) with %d\n", - blow, alow, JACOBI_BIT1_TO_PN (result_bit1))); + blow, alow, JACOBI_BIT1_TO_PN (result_bit1))); return mpn_jacobi_base (blow, alow, result_bit1); zero: diff --git a/tests/mpz/t-jac.c b/tests/mpz/t-jac.c index 1c951590b..8b86f92ef 100644 --- a/tests/mpz/t-jac.c +++ b/tests/mpz/t-jac.c @@ -925,7 +925,7 @@ mpz_nextprime_step (mpz_ptr p, mpz_srcptr n, mpz_srcptr step_in) prime += primegap[i]; } - /* INCR_LIMIT * (max_prime - 1) must fit in an unsigned. */ + /* INCR_LIMIT * (max_prime - 1) must fit in an unsigned. */ #define INCR_LIMIT 0x10000 for (difference = incr = 0; incr < INCR_LIMIT; difference ++) @@ -944,7 +944,7 @@ mpz_nextprime_step (mpz_ptr p, mpz_srcptr n, mpz_srcptr step_in) if (r == 0) goto next; } - + mpz_addmul_ui (p, step, difference); difference = 0; @@ -956,7 +956,7 @@ mpz_nextprime_step (mpz_ptr p, mpz_srcptr n, mpz_srcptr step_in) next:; incr ++; } - + mpz_addmul_ui (p, step, difference); difference = 0; } @@ -992,7 +992,7 @@ check_large_quotients (void) mpz_set_ui (op1, 0); mpz_urandomb (bs, rands, 32); mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1); - + gcd_size = 1 + mpz_get_ui (bs); if (gcd_size & 1) { diff --git a/tests/refmpz.c b/tests/refmpz.c index 785a703ef..67df09862 100644 --- a/tests/refmpz.c +++ b/tests/refmpz.c @@ -201,7 +201,7 @@ refmpz_legendre (mpz_srcptr a, mpz_srcptr p) ASSERT_ALWAYS (mpz_sgn (p) > 0); ASSERT_ALWAYS (mpz_odd_p (p)); - + mpz_init (r); mpz_init (e); diff --git a/tune/README b/tune/README index 41f88fbf2..b6e41eda0 100644 --- a/tune/README +++ b/tune/README @@ -91,7 +91,7 @@ Timing on GNU/Linux LIBS="$old_LIBS" AC_SUBST(TUNE_LIBS) - + might work. Low resolution timebase |