summaryrefslogtreecommitdiff
path: root/mpz/cong_2exp.c
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2010-11-22 22:26:05 +0100
committerTorbjorn Granlund <tege@gmplib.org>2010-11-22 22:26:05 +0100
commit198a1add0f2d556eb75bf2d85c7fceb9fafe9f51 (patch)
treec4fa3b97e983d3f057c0ba032faf39fe303d8f3b /mpz/cong_2exp.c
parentd7afa9ea9c7dae166cb6719c3b11db9c96cca519 (diff)
downloadgmp-198a1add0f2d556eb75bf2d85c7fceb9fafe9f51.tar.gz
Whitespace cleanup.
Diffstat (limited to 'mpz/cong_2exp.c')
-rw-r--r--mpz/cong_2exp.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/mpz/cong_2exp.c b/mpz/cong_2exp.c
index bf3ae54cc..b4fb08013 100644
--- a/mpz/cong_2exp.c
+++ b/mpz/cong_2exp.c
@@ -55,23 +55,23 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
/* a==c for limbs in common */
if (mpn_cmp (ap, cp, MIN (csize, dlimbs)) != 0)
- return 0;
+ return 0;
/* if that's all of dlimbs, then a==c for remaining bits */
if (csize > dlimbs)
- return ((ap[dlimbs]-cp[dlimbs]) & dmask) == 0;
+ return ((ap[dlimbs]-cp[dlimbs]) & dmask) == 0;
a_zeros:
/* a remains, need all zero bits */
/* if d covers all of a and c, then must be exactly equal */
if (asize <= dlimbs)
- return asize == csize;
+ return asize == csize;
/* whole limbs zero */
for (i = csize; i < dlimbs; i++)
- if (ap[i] != 0)
- return 0;
+ if (ap[i] != 0)
+ return 0;
/* partial limb zero */
return (ap[dlimbs] & dmask) == 0;
@@ -81,63 +81,63 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
/* different signs, negated comparison */
/* common low zero limbs, stopping at first non-zeros, which must
- match twos complement */
+ match twos complement */
i = 0;
for (;;)
- {
- ASSERT (i < csize); /* always have a non-zero limb on c */
- alimb = ap[i];
- climb = cp[i];
- sum = (alimb + climb) & GMP_NUMB_MASK;
+ {
+ ASSERT (i < csize); /* always have a non-zero limb on c */
+ alimb = ap[i];
+ climb = cp[i];
+ sum = (alimb + climb) & GMP_NUMB_MASK;
- if (i >= dlimbs)
- return (sum & dmask) == 0;
- i++;
+ if (i >= dlimbs)
+ return (sum & dmask) == 0;
+ i++;
- /* require both zero, or first non-zeros as twos-complements */
- if (sum != 0)
- return 0;
+ /* require both zero, or first non-zeros as twos-complements */
+ if (sum != 0)
+ return 0;
- if (alimb != 0)
- break;
- }
+ if (alimb != 0)
+ break;
+ }
/* further limbs matching as ones-complement */
for (;;)
- {
- if (i >= csize)
- break;
+ {
+ if (i >= csize)
+ break;
- alimb = ap[i];
- climb = cp[i];
- sum = (alimb + climb + 1) & GMP_NUMB_MASK;
+ alimb = ap[i];
+ climb = cp[i];
+ sum = (alimb + climb + 1) & GMP_NUMB_MASK;
- if (i >= dlimbs)
- return (sum & dmask) == 0;
+ if (i >= dlimbs)
+ return (sum & dmask) == 0;
- if (sum != 0)
- return 0;
+ if (sum != 0)
+ return 0;
- i++;
- }
+ i++;
+ }
/* no more c, so require all 1 bits in a */
if (asize < dlimbs)
- return 0; /* not enough a */
+ return 0; /* not enough a */
/* whole limbs */
for ( ; i < dlimbs; i++)
- if (ap[i] != GMP_NUMB_MAX)
- return 0;
+ if (ap[i] != GMP_NUMB_MAX)
+ return 0;
/* if only whole limbs, no further fetches from a */
if (dbits == 0)
- return 1;
+ return 1;
/* need enough a */
if (asize == dlimbs)
- return 0;
+ return 0;
return ((ap[dlimbs]+1) & dmask) == 0;
}