summaryrefslogtreecommitdiff
path: root/mpf/mul_ui.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2003-04-08 23:34:44 +0200
committerKevin Ryde <user42@zip.com.au>2003-04-08 23:34:44 +0200
commitbe870b4d4eb9f91201f91e16c6f77b0233443c0f (patch)
tree3dc0d8c31941faefcf372e589fe3fa12b49b4cf1 /mpf/mul_ui.c
parent1d98839f4e3f5bd226a1cdf97c65ced09855c6fb (diff)
downloadgmp-be870b4d4eb9f91201f91e16c6f77b0233443c0f.tar.gz
* mpf/mul_ui.c [nails]: Call mpf_mul to handle v > GMP_NUMB_MAX.
Diffstat (limited to 'mpf/mul_ui.c')
-rw-r--r--mpf/mul_ui.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/mpf/mul_ui.c b/mpf/mul_ui.c
index 89df878f3..0f3b45c5f 100644
--- a/mpf/mul_ui.c
+++ b/mpf/mul_ui.c
@@ -1,6 +1,6 @@
/* mpf_mul_ui -- Multiply a float and an unsigned integer.
-Copyright 1993, 1994, 1996, 2001 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2001, 2003 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -40,6 +40,22 @@ mpf_mul_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)
return;
}
+#if GMP_NAIL_BITS != 0
+ if (v > GMP_NUMB_MAX)
+ {
+ mpf_t vf;
+ mp_limb_t vp[2];
+ vp[0] = v & GMP_NUMB_MASK;
+ vp[1] = v >> GMP_NUMB_BITS;
+ PTR(vf) = vp;
+ SIZ(vf) = 2;
+ ASSERT_CODE (PREC(vf) = 2);
+ EXP(vf) = 2;
+ mpf_mul (r, u, vf);
+ return;
+ }
+#endif
+
size = ABS (usize);
prec = r->_mp_prec;
up = u->_mp_d;