summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-12-14 02:17:05 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-12-14 02:17:05 +0000
commita8aee68124a0ec7b1dedfcc3ec720b7fd73b2c4f (patch)
treeba9accd29b25626aa4e4f3d3396ff9c94e0d5759
parentf78933265835f632fff2d638f4cc51bf554ecd81 (diff)
downloadmpfr-a8aee68124a0ec7b1dedfcc3ec720b7fd73b2c4f.tar.gz
[src/{mul.c,sqr.c}] Minor changes, making code similar to sub1sp.c.
Checked with grep -A 1 'sb *>>' src/*.c that the bug fixed in r11974 does not occur in other parts of the code. BTW, there is much duplicate code, as shown by the grep output, and using macros could have avoided that, making bugs easier to reproduce (since a same bug would be duplicate several times). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11975 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mul.c8
-rw-r--r--src/sqr.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/mul.c b/src/mul.c
index dbacaf1b7..c22a49222 100644
--- a/src/mul.c
+++ b/src/mul.c
@@ -242,7 +242,7 @@ mpfr_mul_1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode,
needed in asm). Make sure that GCC generates optimized code once
it supports carry-in. */
a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
}
rb = a0 & (MPFR_LIMB_ONE << (sh - 1));
sb |= (a0 & mask) ^ rb;
@@ -333,7 +333,7 @@ mpfr_mul_1n (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode)
needed in asm). Make sure that GCC generates optimized code once
it supports carry-in. */
a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
}
rb = sb & MPFR_LIMB_HIGHBIT;
sb = sb & ~MPFR_LIMB_HIGHBIT;
@@ -461,7 +461,7 @@ mpfr_mul_2 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode,
ax --;
h = (h << 1) | (l >> (GMP_NUMB_BITS - 1));
l = (l << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
/* no need to shift sb2 since we only want to know if it is zero or not */
}
ap[1] = h;
@@ -595,7 +595,7 @@ mpfr_mul_3 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode,
a2 = (a2 << 1) | (a1 >> (GMP_NUMB_BITS - 1));
a1 = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1));
a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
/* no need to shift sb2: we only need to know if it is zero or not */
}
ap[2] = a2;
diff --git a/src/sqr.c b/src/sqr.c
index cacb369de..ac912b19b 100644
--- a/src/sqr.c
+++ b/src/sqr.c
@@ -50,7 +50,7 @@ mpfr_sqr_1 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p)
{
ax --;
a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
}
rb = a0 & (MPFR_LIMB_ONE << (sh - 1));
sb |= (a0 & mask) ^ rb;
@@ -143,7 +143,7 @@ mpfr_sqr_1n (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode)
{
ax --;
a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
}
rb = sb & MPFR_LIMB_HIGHBIT;
sb = sb & ~MPFR_LIMB_HIGHBIT;
@@ -270,7 +270,7 @@ mpfr_sqr_2 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p)
ax --;
h = (h << 1) | (l >> (GMP_NUMB_BITS - 1));
l = (l << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
/* no need to shift sb2 since we only want to know if it is zero or not */
}
ap[1] = h;
@@ -412,7 +412,7 @@ mpfr_sqr_3 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p)
a2 = (a2 << 1) | (a1 >> (GMP_NUMB_BITS - 1));
a1 = (a1 << 1) | (a0 >> (GMP_NUMB_BITS - 1));
a0 = (a0 << 1) | (sb >> (GMP_NUMB_BITS - 1));
- sb = sb << 1;
+ sb <<= 1;
/* no need to shift sb2: we only need to know if it is zero or not */
}
ap[2] = a2;