summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-12 12:11:04 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-12 12:11:04 +0000
commit7ff4624f6b41a7fce4746e6e4e9e9e65a7f95839 (patch)
treea84121b36316620412c2090058ca64b285a79396
parenteae92cd739b6b2387c5e97183652de37fb0054da (diff)
downloadmpfr-7ff4624f6b41a7fce4746e6e4e9e9e65a7f95839.tar.gz
[src/rec_sqrt.c] Replaced "if (GMP_NUMB_BITS >= 16)" by a preprocessor
test "#if GMP_NUMB_BITS >= 16" like earlier. Use static assertions. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13175 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/rec_sqrt.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/rec_sqrt.c b/src/rec_sqrt.c
index 55de0d892..2c35d737d 100644
--- a/src/rec_sqrt.c
+++ b/src/rec_sqrt.c
@@ -184,7 +184,8 @@ mpfr_mpn_rec_sqrt (mpfr_limb_ptr x, mpfr_prec_t p,
/* take the 12+as most significant bits of A */
#if GMP_NUMB_BITS >= 16
i = a[an - 1] >> (GMP_NUMB_BITS - (12 + as));
-#else /* GMP_NUMB_BITS = 8 */
+#else
+ MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 8);
{
unsigned int a12 = a[an - 1] << 8;
if (an >= 2)
@@ -197,15 +198,15 @@ mpfr_mpn_rec_sqrt (mpfr_limb_ptr x, mpfr_prec_t p,
ab = i >> 4;
ac = (ab & 0x3F0) | (i & 0x0F);
t = T1[ab - 0x80] + T2[ac - 0x80]; /* fits on 16 bits */
- if (GMP_NUMB_BITS >= 16) /* x has only one limb */
- x[0] = (mp_limb_t) t << (GMP_NUMB_BITS - p);
- else
- {
- MPFR_ASSERTD (GMP_NUMB_BITS == 8);
- MPFR_ASSERTD (1024 <= t && t <= 2047);
- x[1] = t >> 3; /* 128 <= x[1] <= 255 */
- x[0] = MPFR_LIMB_LSHIFT(t, 5);
- }
+#if GMP_NUMB_BITS >= 16
+ /* x has only one limb */
+ x[0] = (mp_limb_t) t << (GMP_NUMB_BITS - p);
+#else
+ MPFR_STAT_STATIC_ASSERT (GMP_NUMB_BITS == 8);
+ MPFR_ASSERTD (1024 <= t && t <= 2047);
+ x[1] = t >> 3; /* 128 <= x[1] <= 255 */
+ x[0] = MPFR_LIMB_LSHIFT(t, 5);
+#endif
}
else /* p >= 12 */
{