summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2002-05-21 23:54:50 +0200
committertege <tege@gmplib.org>2002-05-21 23:54:50 +0200
commit03047b13a1214ea21047478829f9effd96a318f2 (patch)
treee3dfd664b5a5ff530b32b4e6032e0cff89ba26c9
parentc80050a97644474b19fee3a3e85eaf003ceedb5f (diff)
downloadgmp-03047b13a1214ea21047478829f9effd96a318f2.tar.gz
Nailify.
-rw-r--r--mpz/lcm_ui.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/mpz/lcm_ui.c b/mpz/lcm_ui.c
index 233ab9a00..84fadfffb 100644
--- a/mpz/lcm_ui.c
+++ b/mpz/lcm_ui.c
@@ -1,6 +1,6 @@
/* mpz_lcm_ui -- least common multiple of mpz and ulong.
-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -33,6 +33,20 @@ mpz_lcm_ui (mpz_ptr r, mpz_srcptr u, unsigned long v)
unsigned long g;
mp_limb_t c;
+#if GMP_NAIL_BITS != 0
+ if (v > GMP_NUMB_MAX)
+ {
+ mpz_t vz;
+ mp_limb_t vlimbs[2];
+ vlimbs[0] = v & GMP_NUMB_MASK;
+ vlimbs[1] = v >> GMP_NUMB_BITS;
+ PTR(vz) = vlimbs;
+ SIZ(vz) = 2;
+ mpz_lcm (r, u, vz);
+ return;
+ }
+#endif
+
/* result zero if either operand zero */
usize = SIZ(u);
if (usize == 0 || v == 0)