summaryrefslogtreecommitdiff
path: root/mpz
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2006-02-28 03:11:22 +0100
committertege <tege@gmplib.org>2006-02-28 03:11:22 +0100
commitca28d883e7ece69760527005c48f1a81ab679d5e (patch)
tree10a8ad1e3f88d6ec29f62bedcfc4bc17cbdcc487 /mpz
parentb505eb322492ca2554c417b681dd53cdf73be68c (diff)
downloadgmp-ca28d883e7ece69760527005c48f1a81ab679d5e.tar.gz
Make it work for LIMBS_PER_DOUBLE == 4.
Diffstat (limited to 'mpz')
-rw-r--r--mpz/set_d.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/mpz/set_d.c b/mpz/set_d.c
index bd4a7a26e..2a9cf4232 100644
--- a/mpz/set_d.c
+++ b/mpz/set_d.c
@@ -58,45 +58,48 @@ mpz_set_d (mpz_ptr r, double d)
rp = PTR (r);
-#if BITS_PER_MP_LIMB == 32
switch (rn)
{
default:
- MPN_ZERO (rp, rn - 3);
- rp += rn - 3;
+ MPN_ZERO (rp, rn - LIMBS_PER_DOUBLE);
+ rp += rn - LIMBS_PER_DOUBLE;
/* fall through */
+#if LIMBS_PER_DOUBLE == 2
+ case 2:
+ rp[1] = tp[1], rp[0] = tp[0];
+ break;
+ case 1:
+ rp[0] = tp[1];
+ break;
+#endif
+#if LIMBS_PER_DOUBLE == 3
case 3:
- rp[2] = tp[2];
- rp[1] = tp[1];
- rp[0] = tp[0];
+ rp[2] = tp[2], rp[1] = tp[1], rp[0] = tp[0];
break;
case 2:
- rp[1] = tp[2];
- rp[0] = tp[1];
+ rp[1] = tp[2], rp[0] = tp[1];
break;
case 1:
rp[0] = tp[2];
break;
- case 0:
+#endif
+#if LIMBS_PER_DOUBLE == 4
+ case 4:
+ rp[3] = tp[3], rp[2] = tp[2], rp[1] = tp[1], rp[0] = tp[0];
+ break;
+ case 3:
+ rp[2] = tp[3], rp[1] = tp[2], rp[0] = tp[1];
break;
- }
-#else
- switch (rn)
- {
- default:
- MPN_ZERO (rp, rn - 2);
- rp += rn - 2;
- /* fall through */
case 2:
- rp[1] = tp[1], rp[0] = tp[0];
+ rp[1] = tp[3], rp[0] = tp[2];
break;
case 1:
- rp[0] = tp[1];
+ rp[0] = tp[3];
break;
+#endif
case 0:
break;
}
-#endif
SIZ(r) = negative ? -rn : rn;
}