diff options
author | Roland McGrath <roland@gnu.org> | 1996-03-01 18:45:35 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-03-01 18:45:35 +0000 |
commit | 6b628d3634559ddd84148ed860a0e1e967b5d59c (patch) | |
tree | 59e9370cd3fdf04ebe25ce605465f9057e24e081 /sysdeps/generic | |
parent | bc47d7a85be6334801853aaee489c875646ecb00 (diff) | |
download | glibc-6b628d3634559ddd84148ed860a0e1e967b5d59c.tar.gz glibc-6b628d3634559ddd84148ed860a0e1e967b5d59c.tar.xz glibc-6b628d3634559ddd84148ed860a0e1e967b5d59c.zip |
* stdlib/Makefile (mpn-stuff): New target.
(copy-mpn): Use it. * Code copied from GMP updated to 1.937 version. * stdlib/strtod.c (HAVE_ALLOCA): Define this for gmp headers.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/add_n.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/addmul_1.c | 6 | ||||
-rw-r--r-- | sysdeps/generic/cmp.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/divmod_1.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/lshift.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/mod_1.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/mul.c | 36 | ||||
-rw-r--r-- | sysdeps/generic/mul_1.c | 6 | ||||
-rw-r--r-- | sysdeps/generic/mul_n.c | 110 | ||||
-rw-r--r-- | sysdeps/generic/rshift.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/sub_n.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/submul_1.c | 6 |
12 files changed, 110 insertions, 110 deletions
diff --git a/sysdeps/generic/add_n.c b/sysdeps/generic/add_n.c index 6989ab0628..647548d4c1 100644 --- a/sysdeps/generic/add_n.c +++ b/sysdeps/generic/add_n.c @@ -1,6 +1,6 @@ -/* __mpn_add_n -- Add two limb vectors of equal, non-zero length. +/* mpn_add_n -- Add two limb vectors of equal, non-zero length. -Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -23,9 +23,9 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) +mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) #else -__mpn_add_n (res_ptr, s1_ptr, s2_ptr, size) +mpn_add_n (res_ptr, s1_ptr, s2_ptr, size) register mp_ptr res_ptr; register mp_srcptr s1_ptr; register mp_srcptr s2_ptr; diff --git a/sysdeps/generic/addmul_1.c b/sysdeps/generic/addmul_1.c index fdf3541561..6156cab82c 100644 --- a/sysdeps/generic/addmul_1.c +++ b/sysdeps/generic/addmul_1.c @@ -1,9 +1,9 @@ -/* __mpn_addmul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR +/* mpn_addmul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR by S2_LIMB, add the S1_SIZE least significant limbs of the product to the limb vector pointed to by RES_PTR. Return the most significant limb of the product, adjusted for carry-out from the addition. -Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "longlong.h" mp_limb -__mpn_addmul_1 (res_ptr, s1_ptr, s1_size, s2_limb) +mpn_addmul_1 (res_ptr, s1_ptr, s1_size, s2_limb) register mp_ptr res_ptr; register mp_srcptr s1_ptr; mp_size_t s1_size; diff --git a/sysdeps/generic/cmp.c b/sysdeps/generic/cmp.c index 144c88588f..e499b1ec44 100644 --- a/sysdeps/generic/cmp.c +++ b/sysdeps/generic/cmp.c @@ -1,6 +1,6 @@ -/* __mpn_cmp -- Compare two low-level natural-number integers. +/* mpn_cmp -- Compare two low-level natural-number integers. -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -28,9 +28,9 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ int #if __STDC__ -__mpn_cmp (mp_srcptr op1_ptr, mp_srcptr op2_ptr, mp_size_t size) +mpn_cmp (mp_srcptr op1_ptr, mp_srcptr op2_ptr, mp_size_t size) #else -__mpn_cmp (op1_ptr, op2_ptr, size) +mpn_cmp (op1_ptr, op2_ptr, size) mp_srcptr op1_ptr; mp_srcptr op2_ptr; mp_size_t size; diff --git a/sysdeps/generic/divmod_1.c b/sysdeps/generic/divmod_1.c index 2989d36708..c04032750c 100644 --- a/sysdeps/generic/divmod_1.c +++ b/sysdeps/generic/divmod_1.c @@ -1,4 +1,4 @@ -/* __mpn_divmod_1(quot_ptr, dividend_ptr, dividend_size, divisor_limb) -- +/* mpn_divmod_1(quot_ptr, dividend_ptr, dividend_size, divisor_limb) -- Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB. Write DIVIDEND_SIZE limbs of quotient at QUOT_PTR. Return the single-limb remainder. @@ -6,7 +6,7 @@ QUOT_PTR and DIVIDEND_PTR might point to the same limb. -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -41,11 +41,11 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_divmod_1 (mp_ptr quot_ptr, +mpn_divmod_1 (mp_ptr quot_ptr, mp_srcptr dividend_ptr, mp_size_t dividend_size, mp_limb divisor_limb) #else -__mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb) +mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb) mp_ptr quot_ptr; mp_srcptr dividend_ptr; mp_size_t dividend_size; diff --git a/sysdeps/generic/lshift.c b/sysdeps/generic/lshift.c index 1ba09038dd..35794e4ea8 100644 --- a/sysdeps/generic/lshift.c +++ b/sysdeps/generic/lshift.c @@ -1,6 +1,6 @@ -/* __mpn_lshift -- Shift left low level. +/* mpn_lshift -- Shift left low level. -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -32,11 +32,11 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_lshift (register mp_ptr wp, +mpn_lshift (register mp_ptr wp, register mp_srcptr up, mp_size_t usize, register unsigned int cnt) #else -__mpn_lshift (wp, up, usize, cnt) +mpn_lshift (wp, up, usize, cnt) register mp_ptr wp; register mp_srcptr up; mp_size_t usize; diff --git a/sysdeps/generic/mod_1.c b/sysdeps/generic/mod_1.c index 8a49fb4be0..0842f6b1ee 100644 --- a/sysdeps/generic/mod_1.c +++ b/sysdeps/generic/mod_1.c @@ -1,4 +1,4 @@ -/* __mpn_mod_1(dividend_ptr, dividend_size, divisor_limb) -- +/* mpn_mod_1(dividend_ptr, dividend_size, divisor_limb) -- Divide (DIVIDEND_PTR,,DIVIDEND_SIZE) by DIVISOR_LIMB. Return the single-limb remainder. There are no constraints on the value of the divisor. @@ -38,10 +38,10 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_mod_1 (mp_srcptr dividend_ptr, mp_size_t dividend_size, - mp_limb divisor_limb) +mpn_mod_1 (mp_srcptr dividend_ptr, mp_size_t dividend_size, + mp_limb divisor_limb) #else -__mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb) +mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb) mp_srcptr dividend_ptr; mp_size_t dividend_size; mp_limb divisor_limb; diff --git a/sysdeps/generic/mul.c b/sysdeps/generic/mul.c index cd2acb5127..3f3f41e99f 100644 --- a/sysdeps/generic/mul.c +++ b/sysdeps/generic/mul.c @@ -1,6 +1,6 @@ -/* __mpn_mul -- Multiply two natural numbers. +/* mpn_mul -- Multiply two natural numbers. -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -43,11 +43,11 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_mul (mp_ptr prodp, - mp_srcptr up, mp_size_t usize, - mp_srcptr vp, mp_size_t vsize) +mpn_mul (mp_ptr prodp, + mp_srcptr up, mp_size_t usize, + mp_srcptr vp, mp_size_t vsize) #else -__mpn_mul (prodp, up, usize, vp, vsize) +mpn_mul (prodp, up, usize, vp, vsize) mp_ptr prodp; mp_srcptr up; mp_size_t usize; @@ -58,6 +58,7 @@ __mpn_mul (prodp, up, usize, vp, vsize) mp_ptr prod_endp = prodp + usize + vsize - 1; mp_limb cy; mp_ptr tspace; + TMP_DECL (marker); if (vsize < KARATSUBA_THRESHOLD) { @@ -86,7 +87,7 @@ __mpn_mul (prodp, up, usize, vp, vsize) cy_limb = 0; } else - cy_limb = __mpn_mul_1 (prodp, up, usize, v_limb); + cy_limb = mpn_mul_1 (prodp, up, usize, v_limb); prodp[usize] = cy_limb; prodp++; @@ -100,10 +101,10 @@ __mpn_mul (prodp, up, usize, vp, vsize) { cy_limb = 0; if (v_limb == 1) - cy_limb = __mpn_add_n (prodp, prodp, up, usize); + cy_limb = mpn_add_n (prodp, prodp, up, usize); } else - cy_limb = __mpn_addmul_1 (prodp, up, usize, v_limb); + cy_limb = mpn_addmul_1 (prodp, up, usize, v_limb); prodp[usize] = cy_limb; prodp++; @@ -111,7 +112,9 @@ __mpn_mul (prodp, up, usize, vp, vsize) return cy_limb; } - tspace = (mp_ptr) alloca (2 * vsize * BYTES_PER_MP_LIMB); + TMP_MARK (marker); + + tspace = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB); MPN_MUL_N_RECURSE (prodp, up, vp, vsize, tspace); prodp += vsize; @@ -119,12 +122,12 @@ __mpn_mul (prodp, up, usize, vp, vsize) usize -= vsize; if (usize >= vsize) { - mp_ptr tp = (mp_ptr) alloca (2 * vsize * BYTES_PER_MP_LIMB); + mp_ptr tp = (mp_ptr) TMP_ALLOC (2 * vsize * BYTES_PER_MP_LIMB); do { MPN_MUL_N_RECURSE (tp, up, vp, vsize, tspace); - cy = __mpn_add_n (prodp, prodp, tp, vsize); - __mpn_add_1 (prodp + vsize, tp + vsize, vsize, cy); + cy = mpn_add_n (prodp, prodp, tp, vsize); + mpn_add_1 (prodp + vsize, tp + vsize, vsize, cy); prodp += vsize; up += vsize; usize -= vsize; @@ -138,10 +141,11 @@ __mpn_mul (prodp, up, usize, vp, vsize) if (usize != 0) { - __mpn_mul (tspace, vp, vsize, up, usize); - cy = __mpn_add_n (prodp, prodp, tspace, vsize); - __mpn_add_1 (prodp + vsize, tspace + vsize, usize, cy); + mpn_mul (tspace, vp, vsize, up, usize); + cy = mpn_add_n (prodp, prodp, tspace, vsize); + mpn_add_1 (prodp + vsize, tspace + vsize, usize, cy); } + TMP_FREE (marker); return *prod_endp; } diff --git a/sysdeps/generic/mul_1.c b/sysdeps/generic/mul_1.c index 37dbc33031..01fdbbbc9b 100644 --- a/sysdeps/generic/mul_1.c +++ b/sysdeps/generic/mul_1.c @@ -1,7 +1,7 @@ -/* __mpn_mul_1 -- Multiply a limb vector with a single limb and +/* mpn_mul_1 -- Multiply a limb vector with a single limb and store the product in a second limb vector. -Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "longlong.h" mp_limb -__mpn_mul_1 (res_ptr, s1_ptr, s1_size, s2_limb) +mpn_mul_1 (res_ptr, s1_ptr, s1_size, s2_limb) register mp_ptr res_ptr; register mp_srcptr s1_ptr; mp_size_t s1_size; diff --git a/sysdeps/generic/mul_n.c b/sysdeps/generic/mul_n.c index e37c5d8290..049f63dce8 100644 --- a/sysdeps/generic/mul_n.c +++ b/sysdeps/generic/mul_n.c @@ -1,6 +1,6 @@ -/* __mpn_mul_n -- Multiply two natural numbers of length n. +/* mpn_mul_n -- Multiply two natural numbers of length n. -Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -41,13 +41,6 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define KARATSUBA_THRESHOLD 2 #endif -void -#if __STDC__ -____mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr); -#else -____mpn_mul_n (); -#endif - /* Handle simple cases with traditional multiplication. This is the most critical code of multiplication. All multiplies rely @@ -57,9 +50,9 @@ ____mpn_mul_n (); void #if __STDC__ -____mpn_mul_n_basecase (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size) +impn_mul_n_basecase (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size) #else -____mpn_mul_n_basecase (prodp, up, vp, size) +impn_mul_n_basecase (prodp, up, vp, size) mp_ptr prodp; mp_srcptr up; mp_srcptr vp; @@ -82,7 +75,7 @@ ____mpn_mul_n_basecase (prodp, up, vp, size) cy_limb = 0; } else - cy_limb = __mpn_mul_1 (prodp, up, size, v_limb); + cy_limb = mpn_mul_1 (prodp, up, size, v_limb); prodp[size] = cy_limb; prodp++; @@ -96,10 +89,10 @@ ____mpn_mul_n_basecase (prodp, up, vp, size) { cy_limb = 0; if (v_limb == 1) - cy_limb = __mpn_add_n (prodp, prodp, up, size); + cy_limb = mpn_add_n (prodp, prodp, up, size); } else - cy_limb = __mpn_addmul_1 (prodp, up, size, v_limb); + cy_limb = mpn_addmul_1 (prodp, up, size, v_limb); prodp[size] = cy_limb; prodp++; @@ -108,10 +101,10 @@ ____mpn_mul_n_basecase (prodp, up, vp, size) void #if __STDC__ -____mpn_mul_n (mp_ptr prodp, +impn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size, mp_ptr tspace) #else -____mpn_mul_n (prodp, up, vp, size, tspace) +impn_mul_n (prodp, up, vp, size, tspace) mp_ptr prodp; mp_srcptr up; mp_srcptr vp; @@ -135,9 +128,9 @@ ____mpn_mul_n (prodp, up, vp, size, tspace) mp_limb cy_limb; MPN_MUL_N_RECURSE (prodp, up, vp, esize, tspace); - cy_limb = __mpn_addmul_1 (prodp + esize, up, esize, vp[esize]); + cy_limb = mpn_addmul_1 (prodp + esize, up, esize, vp[esize]); prodp[esize + esize] = cy_limb; - cy_limb = __mpn_addmul_1 (prodp + esize, vp, size, up[esize]); + cy_limb = mpn_addmul_1 (prodp + esize, vp, size, up[esize]); prodp[esize + size] = cy_limb; } @@ -170,24 +163,24 @@ ____mpn_mul_n (prodp, up, vp, size, tspace) /*** Product M. ________________ |_(U1-U0)(V0-V1)_| */ - if (__mpn_cmp (up + hsize, up, hsize) >= 0) + if (mpn_cmp (up + hsize, up, hsize) >= 0) { - __mpn_sub_n (prodp, up + hsize, up, hsize); + mpn_sub_n (prodp, up + hsize, up, hsize); negflg = 0; } else { - __mpn_sub_n (prodp, up, up + hsize, hsize); + mpn_sub_n (prodp, up, up + hsize, hsize); negflg = 1; } - if (__mpn_cmp (vp + hsize, vp, hsize) >= 0) + if (mpn_cmp (vp + hsize, vp, hsize) >= 0) { - __mpn_sub_n (prodp + hsize, vp + hsize, vp, hsize); + mpn_sub_n (prodp + hsize, vp + hsize, vp, hsize); negflg ^= 1; } else { - __mpn_sub_n (prodp + hsize, vp, vp + hsize, hsize); + mpn_sub_n (prodp + hsize, vp, vp + hsize, hsize); /* No change of NEGFLG. */ } /* Read temporary operands from low part of PROD. @@ -197,13 +190,13 @@ ____mpn_mul_n (prodp, up, vp, size, tspace) /*** Add/copy product H. */ MPN_COPY (prodp + hsize, prodp + size, hsize); - cy = __mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize); + cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize); /*** Add product M (if NEGFLG M is a negative number). */ if (negflg) - cy -= __mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size); + cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size); else - cy += __mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); + cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); /*** Product L. ________________ ________________ |________________||____U0 x V0_____| */ @@ -214,22 +207,22 @@ ____mpn_mul_n (prodp, up, vp, size, tspace) /*** Add/copy Product L (twice). */ - cy += __mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); + cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); if (cy) - __mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy); + mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy); MPN_COPY (prodp, tspace, hsize); - cy = __mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); + cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); if (cy) - __mpn_add_1 (prodp + size, prodp + size, size, 1); + mpn_add_1 (prodp + size, prodp + size, size, 1); } } void #if __STDC__ -____mpn_sqr_n_basecase (mp_ptr prodp, mp_srcptr up, mp_size_t size) +impn_sqr_n_basecase (mp_ptr prodp, mp_srcptr up, mp_size_t size) #else -____mpn_sqr_n_basecase (prodp, up, size) +impn_sqr_n_basecase (prodp, up, size) mp_ptr prodp; mp_srcptr up; mp_size_t size; @@ -251,7 +244,7 @@ ____mpn_sqr_n_basecase (prodp, up, size) cy_limb = 0; } else - cy_limb = __mpn_mul_1 (prodp, up, size, v_limb); + cy_limb = mpn_mul_1 (prodp, up, size, v_limb); prodp[size] = cy_limb; prodp++; @@ -265,10 +258,10 @@ ____mpn_sqr_n_basecase (prodp, up, size) { cy_limb = 0; if (v_limb == 1) - cy_limb = __mpn_add_n (prodp, prodp, up, size); + cy_limb = mpn_add_n (prodp, prodp, up, size); } else - cy_limb = __mpn_addmul_1 (prodp, up, size, v_limb); + cy_limb = mpn_addmul_1 (prodp, up, size, v_limb); prodp[size] = cy_limb; prodp++; @@ -277,10 +270,10 @@ ____mpn_sqr_n_basecase (prodp, up, size) void #if __STDC__ -____mpn_sqr_n (mp_ptr prodp, +impn_sqr_n (mp_ptr prodp, mp_srcptr up, mp_size_t size, mp_ptr tspace) #else -____mpn_sqr_n (prodp, up, size, tspace) +impn_sqr_n (prodp, up, size, tspace) mp_ptr prodp; mp_srcptr up; mp_size_t size; @@ -303,9 +296,9 @@ ____mpn_sqr_n (prodp, up, size, tspace) mp_limb cy_limb; MPN_SQR_N_RECURSE (prodp, up, esize, tspace); - cy_limb = __mpn_addmul_1 (prodp + esize, up, esize, up[esize]); + cy_limb = mpn_addmul_1 (prodp + esize, up, esize, up[esize]); prodp[esize + esize] = cy_limb; - cy_limb = __mpn_addmul_1 (prodp + esize, up, size, up[esize]); + cy_limb = mpn_addmul_1 (prodp + esize, up, size, up[esize]); prodp[esize + size] = cy_limb; } @@ -322,13 +315,13 @@ ____mpn_sqr_n (prodp, up, size, tspace) /*** Product M. ________________ |_(U1-U0)(U0-U1)_| */ - if (__mpn_cmp (up + hsize, up, hsize) >= 0) + if (mpn_cmp (up + hsize, up, hsize) >= 0) { - __mpn_sub_n (prodp, up + hsize, up, hsize); + mpn_sub_n (prodp, up + hsize, up, hsize); } else { - __mpn_sub_n (prodp, up, up + hsize, hsize); + mpn_sub_n (prodp, up, up + hsize, hsize); } /* Read temporary operands from low part of PROD. @@ -338,10 +331,10 @@ ____mpn_sqr_n (prodp, up, size, tspace) /*** Add/copy product H. */ MPN_COPY (prodp + hsize, prodp + size, hsize); - cy = __mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize); + cy = mpn_add_n (prodp + size, prodp + size, prodp + size + hsize, hsize); /*** Add product M (if NEGFLG M is a negative number). */ - cy -= __mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size); + cy -= mpn_sub_n (prodp + hsize, prodp + hsize, tspace, size); /*** Product L. ________________ ________________ |________________||____U0 x U0_____| */ @@ -352,53 +345,56 @@ ____mpn_sqr_n (prodp, up, size, tspace) /*** Add/copy Product L (twice). */ - cy += __mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); + cy += mpn_add_n (prodp + hsize, prodp + hsize, tspace, size); if (cy) - __mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy); + mpn_add_1 (prodp + hsize + size, prodp + hsize + size, hsize, cy); MPN_COPY (prodp, tspace, hsize); - cy = __mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); + cy = mpn_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); if (cy) - __mpn_add_1 (prodp + size, prodp + size, size, 1); + mpn_add_1 (prodp + size, prodp + size, size, 1); } } /* This should be made into an inline function in gmp.h. */ inline void #if __STDC__ -__mpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size) +mpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size) #else -__mpn_mul_n (prodp, up, vp, size) +mpn_mul_n (prodp, up, vp, size) mp_ptr prodp; mp_srcptr up; mp_srcptr vp; mp_size_t size; #endif { + TMP_DECL (marker); + TMP_MARK (marker); if (up == vp) { if (size < KARATSUBA_THRESHOLD) { - ____mpn_sqr_n_basecase (prodp, up, size); + impn_sqr_n_basecase (prodp, up, size); } else { mp_ptr tspace; - tspace = (mp_ptr) alloca (2 * size * BYTES_PER_MP_LIMB); - ____mpn_sqr_n (prodp, up, size, tspace); + tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB); + impn_sqr_n (prodp, up, size, tspace); } } else { if (size < KARATSUBA_THRESHOLD) { - ____mpn_mul_n_basecase (prodp, up, vp, size); + impn_mul_n_basecase (prodp, up, vp, size); } else { mp_ptr tspace; - tspace = (mp_ptr) alloca (2 * size * BYTES_PER_MP_LIMB); - ____mpn_mul_n (prodp, up, vp, size, tspace); + tspace = (mp_ptr) TMP_ALLOC (2 * size * BYTES_PER_MP_LIMB); + impn_mul_n (prodp, up, vp, size, tspace); } } + TMP_FREE (marker); } diff --git a/sysdeps/generic/rshift.c b/sysdeps/generic/rshift.c index 966cc7bcad..7ce02e07f7 100644 --- a/sysdeps/generic/rshift.c +++ b/sysdeps/generic/rshift.c @@ -1,6 +1,6 @@ -/* __mpn_rshift -- Shift right a low-level natural-number integer. +/* mpn_rshift -- Shift right a low-level natural-number integer. -Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -32,11 +32,11 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_rshift (register mp_ptr wp, +mpn_rshift (register mp_ptr wp, register mp_srcptr up, mp_size_t usize, register unsigned int cnt) #else -__mpn_rshift (wp, up, usize, cnt) +mpn_rshift (wp, up, usize, cnt) register mp_ptr wp; register mp_srcptr up; mp_size_t usize; diff --git a/sysdeps/generic/sub_n.c b/sysdeps/generic/sub_n.c index 6b33e6696f..f3c83d1fd6 100644 --- a/sysdeps/generic/sub_n.c +++ b/sysdeps/generic/sub_n.c @@ -1,6 +1,6 @@ -/* __mpn_sub_n -- Subtract two limb vectors of equal, non-zero length. +/* mpn_sub_n -- Subtract two limb vectors of equal, non-zero length. -Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -23,9 +23,9 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ mp_limb #if __STDC__ -__mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) +mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size) #else -__mpn_sub_n (res_ptr, s1_ptr, s2_ptr, size) +mpn_sub_n (res_ptr, s1_ptr, s2_ptr, size) register mp_ptr res_ptr; register mp_srcptr s1_ptr; register mp_srcptr s2_ptr; diff --git a/sysdeps/generic/submul_1.c b/sysdeps/generic/submul_1.c index 855dd3feaf..57122a5784 100644 --- a/sysdeps/generic/submul_1.c +++ b/sysdeps/generic/submul_1.c @@ -1,9 +1,9 @@ -/* __mpn_submul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR +/* mpn_submul_1 -- multiply the S1_SIZE long limb vector pointed to by S1_PTR by S2_LIMB, subtract the S1_SIZE least significant limbs of the product from the limb vector pointed to by RES_PTR. Return the most significant limb of the product, adjusted for carry-out from the subtraction. -Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "longlong.h" mp_limb -__mpn_submul_1 (res_ptr, s1_ptr, s1_size, s2_limb) +mpn_submul_1 (res_ptr, s1_ptr, s1_size, s2_limb) register mp_ptr res_ptr; register mp_srcptr s1_ptr; mp_size_t s1_size; |