Updated from /src/gmp-2.0

This commit is contained in:
Roland McGrath 1996-05-07 21:04:52 +00:00
parent fc38dc5be9
commit b928942eaa
118 changed files with 480 additions and 287 deletions

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* When using gcc, make sure to use its builtin alloca. */
#if ! defined (alloca) && defined (__GNUC__)
@ -68,6 +69,14 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define MIN(l,o) ((l) < (o) ? (l) : (o))
#define MAX(h,i) ((h) > (i) ? (h) : (i))
/* Field access macros. */
#define SIZ(x) ((x)->_mp_size)
#define ABSIZ(x) ABS (SIZ (x))
#define PTR(x) ((x)->_mp_d)
#define EXP(x) ((x)->_mp_exp)
#define PREC(x) ((x)->_mp_prec)
#define ALLOC(x) ((x)->_mp_alloc)
#include "gmp-mparam.h"
/* #include "longlong.h" */
@ -175,9 +184,9 @@ void _mp_default_free ();
strings in base 2..36. */
struct bases
{
/* Number of digits in the conversion base that always fits in an mp_limb.
For example, for base 10 on a machine where a mp_limb has 32 bits this
is 9, since 10**9 is the largest number that fits into a mp_limb. */
/* Number of digits in the conversion base that always fits in an mp_limb_t.
For example, for base 10 on a machine where a mp_limb_t has 32 bits this
is 9, since 10**9 is the largest number that fits into a mp_limb_t. */
int chars_per_limb;
/* log(2)/log(conversion_base) */
@ -186,21 +195,14 @@ struct bases
/* base**chars_per_limb, i.e. the biggest number that fits a word, built by
factors of base. Exception: For 2, 4, 8, etc, big_base is log2(base),
i.e. the number of bits used to represent each digit in the base. */
mp_limb big_base;
mp_limb_t big_base;
/* A BITS_PER_MP_LIMB bit approximation to 1/big_base, represented as a
fixed-point number. Instead of dividing by big_base an application can
choose to multiply by big_base_inverted. */
mp_limb big_base_inverted;
mp_limb_t big_base_inverted;
};
/* Access macros for structure fields for user-visible structures with
hidden fields. */
#define size(X) (X)._mp_size
#define alloc(X) (X)._mp_alloc
#define prec(X) (X)._mp_prec
#define limbs(X) (X)._mp_d
extern const struct bases __mp_bases[];
extern mp_size_t __gmp_default_fp_limb_precision;
@ -211,8 +213,8 @@ extern mp_size_t __gmp_default_fp_limb_precision;
has to be set. Put the quotient in Q and the remainder in R. */
#define udiv_qrnnd_preinv(q, r, nh, nl, d, di) \
do { \
mp_limb _q, _ql, _r; \
mp_limb _xh, _xl; \
mp_limb_t _q, _ql, _r; \
mp_limb_t _xh, _xl; \
umul_ppmm (_q, _ql, (nh), (di)); \
_q += (nh); /* DI is 2**BITS_PER_MP_LIMB too small */\
umul_ppmm (_xh, _xl, _q, (d)); \
@ -239,11 +241,11 @@ extern mp_size_t __gmp_default_fp_limb_precision;
so that its most significant bit is set. LGUP is ceil(log2(D)). */
#define udiv_qrnnd_preinv2gen(q, r, nh, nl, d, di, dnorm, lgup) \
do { \
mp_limb n2, n10, n1, nadj, q1; \
mp_limb _xh, _xl; \
mp_limb_t n2, n10, n1, nadj, q1; \
mp_limb_t _xh, _xl; \
n2 = ((nh) << (BITS_PER_MP_LIMB - (lgup))) + ((nl) >> 1 >> (l - 1));\
n10 = (nl) << (BITS_PER_MP_LIMB - (lgup)); \
n1 = ((mp_limb_signed) n10 >> (BITS_PER_MP_LIMB - 1)); \
n1 = ((mp_limb_signed_t) n10 >> (BITS_PER_MP_LIMB - 1)); \
nadj = n10 + (n1 & (dnorm)); \
umul_ppmm (_xh, _xl, di, n2 - n1); \
add_ssaaaa (_xh, _xl, _xh, _xl, 0, nadj); \
@ -258,11 +260,11 @@ extern mp_size_t __gmp_default_fp_limb_precision;
version to use. */
#define udiv_qrnnd_preinv2norm(q, r, nh, nl, d, di) \
do { \
mp_limb n2, n10, n1, nadj, q1; \
mp_limb _xh, _xl; \
mp_limb_t n2, n10, n1, nadj, q1; \
mp_limb_t _xh, _xl; \
n2 = (nh); \
n10 = (nl); \
n1 = ((mp_limb_signed) n10 >> (BITS_PER_MP_LIMB - 1)); \
n1 = ((mp_limb_signed_t) n10 >> (BITS_PER_MP_LIMB - 1)); \
nadj = n10 + (n1 & (d)); \
umul_ppmm (_xh, _xl, di, n2 - n1); \
add_ssaaaa (_xh, _xl, _xh, _xl, 0, nadj); \
@ -287,7 +289,7 @@ typedef long SItype;
typedef unsigned long USItype;
#endif
typedef mp_limb UWtype;
typedef mp_limb_t UWtype;
typedef unsigned int UHWtype;
#define W_TYPE_SIZE BITS_PER_MP_LIMB

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#ifndef __GMP_H__
@ -47,20 +48,20 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
#ifdef _SHORT_LIMB
typedef unsigned int mp_limb;
typedef int mp_limb_signed;
typedef unsigned int mp_limb_t;
typedef int mp_limb_signed_t;
#else
#ifdef _LONG_LONG_LIMB
typedef unsigned long long int mp_limb;
typedef long long int mp_limb_signed;
typedef unsigned long long int mp_limb_t;
typedef long long int mp_limb_signed_t;
#else
typedef unsigned long int mp_limb;
typedef long int mp_limb_signed;
typedef unsigned long int mp_limb_t;
typedef long int mp_limb_signed_t;
#endif
#endif
typedef mp_limb * mp_ptr;
typedef __gmp_const mp_limb * mp_srcptr;
typedef mp_limb_t * mp_ptr;
typedef __gmp_const mp_limb_t * mp_srcptr;
typedef long int mp_size_t;
typedef long int mp_exp_t;
@ -73,7 +74,7 @@ typedef struct
the last field points to. If SIZE
is negative this is a negative
number. */
mp_limb *_mp_d; /* Pointer to the limbs. */
mp_limb_t *_mp_d; /* Pointer to the limbs. */
} __mpz_struct;
#else
typedef struct
@ -84,7 +85,7 @@ typedef struct
the last field points to. If SIZE
is negative this is a negative
number. */
mp_limb *_mp_d; /* Pointer to the limbs. */
mp_limb_t *_mp_d; /* Pointer to the limbs. */
} __mpz_struct;
#endif
#endif /* __GNU_MP__ */
@ -120,7 +121,7 @@ typedef __mpq_struct mpq_t[1];
typedef struct
{
int _mp_prec; /* Max precision, in number of `mp_limb's.
int _mp_prec; /* Max precision, in number of `mp_limb_t's.
Set by mpf_init and modified by
mpf_set_prec. The area pointed to
by the `d' field contains `prec' + 1
@ -129,8 +130,8 @@ typedef struct
the last field points to. If SIZE
is negative this is a negative
number. */
mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb'. */
mp_limb *_mp_d; /* Pointer to the limbs. */
mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */
mp_limb_t *_mp_d; /* Pointer to the limbs. */
} __mpf_struct;
/* typedef __mpf_struct MP_FLOAT; */
@ -154,7 +155,11 @@ typedef __mpq_struct *mpq_ptr;
#endif
#ifndef __MPN
#if defined (__STDC__) || defined (__cplusplus)
#define __MPN(x) __mpn_##x
#else
#define __MPN(x) __mpn_/**/x
#endif
#endif
#if defined (FILE) || defined (_STDIO_H_) || defined (__STDIO_H__) || defined (H_STDIO)
@ -164,6 +169,7 @@ typedef __mpq_struct *mpq_ptr;
void mp_set_memory_functions _PROTO ((void *(*) (size_t),
void *(*) (void *, size_t, size_t),
void (*) (void *, size_t)));
extern const int mp_bits_per_limb;
/**************** Integer (i.e. Z) routines. ****************/
@ -207,8 +213,8 @@ void mpz_gcdext _PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
/* signed */ long int mpz_get_si _PROTO ((mpz_srcptr));
char *mpz_get_str _PROTO ((char *, int, mpz_srcptr));
unsigned long int mpz_get_ui _PROTO ((mpz_srcptr));
mp_limb mpz_getlimbn _PROTO ((mpz_srcptr, mp_size_t));
mp_size_t mpz_hamdist _PROTO ((mpz_srcptr, mpz_srcptr));
mp_limb_t mpz_getlimbn _PROTO ((mpz_srcptr, mp_size_t));
unsigned long int mpz_hamdist _PROTO ((mpz_srcptr, mpz_srcptr));
void mpz_init _PROTO ((mpz_ptr));
#ifdef _GMP_H_HAVE_FILE
size_t mpz_inp_binary _PROTO ((mpz_ptr, FILE *));
@ -216,6 +222,7 @@ size_t mpz_inp_raw _PROTO ((mpz_ptr, FILE *));
size_t mpz_inp_str _PROTO ((mpz_ptr, FILE *, int));
#endif
void mpz_init_set _PROTO ((mpz_ptr, mpz_srcptr));
void mpz_init_set_d _PROTO ((mpz_ptr, double));
void mpz_init_set_si _PROTO ((mpz_ptr, signed long int));
int mpz_init_set_str _PROTO ((mpz_ptr, const char *, int));
void mpz_init_set_ui _PROTO ((mpz_ptr, unsigned long int));
@ -234,15 +241,15 @@ size_t mpz_out_raw _PROTO ((FILE *, mpz_srcptr));
size_t mpz_out_str _PROTO ((FILE *, int, mpz_srcptr));
#endif
int mpz_perfect_square_p _PROTO ((mpz_srcptr));
mp_size_t mpz_popcount _PROTO ((mpz_srcptr));
unsigned long int mpz_popcount _PROTO ((mpz_srcptr));
void mpz_pow_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
void mpz_powm _PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
void mpz_powm_ui _PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
int mpz_probab_prime_p _PROTO ((mpz_srcptr, int));
void mpz_random _PROTO ((mpz_ptr, mp_size_t));
void mpz_random2 _PROTO ((mpz_ptr, mp_size_t));
mp_size_t mpz_scan0 _PROTO ((mpz_srcptr, mp_size_t));
mp_size_t mpz_scan1 _PROTO ((mpz_srcptr, mp_size_t));
unsigned long int mpz_scan0 _PROTO ((mpz_srcptr, unsigned long int));
unsigned long int mpz_scan1 _PROTO ((mpz_srcptr, unsigned long int));
void mpz_set _PROTO ((mpz_ptr, mpz_srcptr));
void mpz_set_d _PROTO ((mpz_ptr, double));
void mpz_set_si _PROTO ((mpz_ptr, signed long int));
@ -296,14 +303,15 @@ void mpf_clear _PROTO ((mpf_ptr));
int mpf_cmp _PROTO ((mpf_srcptr, mpf_srcptr));
int mpf_cmp_si _PROTO ((mpf_srcptr, signed long int));
int mpf_cmp_ui _PROTO ((mpf_srcptr, unsigned long int));
int mpf_diff _PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int));
void mpf_div _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
void mpf_div_2exp _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
void mpf_div_ui _PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
void mpf_dump _PROTO ((mpf_srcptr));
int mpf_eq _PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int));
unsigned long int mpf_get_prec _PROTO ((mpf_srcptr));
char *mpf_get_str _PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr));
void mpf_init _PROTO ((mpf_ptr));
void mpf_init2 _PROTO ((mpf_ptr, mp_size_t));
void mpf_init2 _PROTO ((mpf_ptr, unsigned long int));
#ifdef _GMP_H_HAVE_FILE
size_t mpf_inp_str _PROTO ((mpf_ptr, FILE *, int));
#endif
@ -319,11 +327,13 @@ void mpf_neg _PROTO ((mpf_ptr, mpf_srcptr));
#ifdef _GMP_H_HAVE_FILE
size_t mpf_out_str _PROTO ((FILE *, int, size_t, mpf_srcptr));
#endif
void mpf_random2 _PROTO ((mpf_ptr, mp_size_t, mp_size_t));
void mpf_random2 _PROTO ((mpf_ptr, mp_size_t, mp_exp_t));
void mpf_reldiff _PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
void mpf_set _PROTO ((mpf_ptr, mpf_srcptr));
void mpf_set_d _PROTO ((mpf_ptr, double));
mp_size_t mpf_set_default_prec _PROTO ((mp_size_t));
void mpf_set_prec _PROTO ((mpf_ptr, mp_size_t));
void mpf_set_default_prec _PROTO ((unsigned long int));
void mpf_set_prec _PROTO ((mpf_ptr, unsigned long int));
void mpf_set_prec_raw _PROTO ((mpf_ptr, unsigned long int));
void mpf_set_si _PROTO ((mpf_ptr, signed long int));
int mpf_set_str _PROTO ((mpf_ptr, const char *, int));
void mpf_set_ui _PROTO ((mpf_ptr, unsigned long int));
@ -378,55 +388,59 @@ void mpf_ui_sub _PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
#if defined (__cplusplus)
extern "C" {
#endif
mp_limb mpn_add_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
mp_limb mpn_addmul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb));
mp_limb mpn_bdivmod _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
mp_limb_t mpn_add _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
mp_limb_t mpn_add_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
mp_limb_t mpn_add_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
mp_limb_t mpn_addmul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
mp_limb_t mpn_bdivmod _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
int mpn_cmp _PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
mp_limb mpn_divmod_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb));
mp_limb mpn_divrem _PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
mp_limb mpn_divrem_1 _PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb));
mp_limb_t mpn_divmod_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
mp_limb_t mpn_divrem _PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
mp_limb_t mpn_divrem_1 _PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
void mpn_dump _PROTO ((mp_srcptr, mp_size_t));
mp_size_t mpn_gcd _PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
mp_limb mpn_gcd_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb));
mp_limb_t mpn_gcd_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
mp_size_t mpn_gcdext _PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
size_t mpn_get_str _PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
mp_size_t mpn_hamdist _PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
mp_limb mpn_lshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
mp_limb mpn_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb));
mp_limb mpn_mul _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
mp_limb mpn_mul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb));
unsigned long int mpn_hamdist _PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
mp_limb_t mpn_lshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
mp_limb_t mpn_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
mp_limb_t mpn_mul _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
mp_limb_t mpn_mul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
void mpn_mul_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
int mpn_perfect_square_p _PROTO ((mp_srcptr, mp_size_t));
mp_size_t mpn_popcount _PROTO ((mp_srcptr, mp_size_t));
mp_limb mpn_preinv_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb, mp_limb));
unsigned long int mpn_popcount _PROTO ((mp_srcptr, mp_size_t));
mp_limb_t mpn_preinv_mod_1 _PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
void mpn_random2 _PROTO ((mp_ptr, mp_size_t));
mp_limb mpn_rshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
mp_size_t mpn_scan0 _PROTO ((mp_srcptr, mp_size_t));
mp_size_t mpn_scan1 _PROTO ((mp_srcptr, mp_size_t));
mp_limb_t mpn_rshift _PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
unsigned long int mpn_scan0 _PROTO ((mp_srcptr, unsigned long int));
unsigned long int mpn_scan1 _PROTO ((mp_srcptr, unsigned long int));
mp_size_t mpn_set_str _PROTO ((mp_ptr, const unsigned char *, size_t, int));
mp_size_t mpn_sqrtrem _PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
mp_limb mpn_sub_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
mp_limb mpn_submul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb));
mp_limb_t mpn_sub _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
mp_limb_t mpn_sub_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
mp_limb_t mpn_sub_n _PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
mp_limb_t mpn_submul_1 _PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
#if defined (__cplusplus)
}
#endif
#if defined (__GNUC__) || defined (_FORCE_INLINES)
_EXTERN_INLINE mp_limb
_EXTERN_INLINE mp_limb_t
#if defined (__STDC__) || defined (__cplusplus)
mpn_add_1 (register mp_ptr res_ptr,
register mp_srcptr s1_ptr,
register mp_size_t s1_size,
register mp_limb s2_limb)
register mp_limb_t s2_limb)
#else
mpn_add_1 (res_ptr, s1_ptr, s1_size, s2_limb)
register mp_ptr res_ptr;
register mp_srcptr s1_ptr;
register mp_size_t s1_size;
register mp_limb s2_limb;
register mp_limb_t s2_limb;
#endif
{
register mp_limb x;
register mp_limb_t x;
x = *s1_ptr++;
s2_limb = x + s2_limb;
@ -454,7 +468,7 @@ mpn_add_1 (res_ptr, s1_ptr, s1_size, s2_limb)
return 0;
}
_EXTERN_INLINE mp_limb
_EXTERN_INLINE mp_limb_t
#if defined (__STDC__) || defined (__cplusplus)
mpn_add (register mp_ptr res_ptr,
register mp_srcptr s1_ptr,
@ -470,7 +484,7 @@ mpn_add (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
register mp_size_t s2_size;
#endif
{
mp_limb cy_limb = 0;
mp_limb_t cy_limb = 0;
if (s2_size != 0)
cy_limb = mpn_add_n (res_ptr, s1_ptr, s2_ptr, s2_size);
@ -483,21 +497,21 @@ mpn_add (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
return cy_limb;
}
_EXTERN_INLINE mp_limb
_EXTERN_INLINE mp_limb_t
#if defined (__STDC__) || defined (__cplusplus)
mpn_sub_1 (register mp_ptr res_ptr,
register mp_srcptr s1_ptr,
register mp_size_t s1_size,
register mp_limb s2_limb)
register mp_limb_t s2_limb)
#else
mpn_sub_1 (res_ptr, s1_ptr, s1_size, s2_limb)
register mp_ptr res_ptr;
register mp_srcptr s1_ptr;
register mp_size_t s1_size;
register mp_limb s2_limb;
register mp_limb_t s2_limb;
#endif
{
register mp_limb x;
register mp_limb_t x;
x = *s1_ptr++;
s2_limb = x - s2_limb;
@ -525,7 +539,7 @@ mpn_sub_1 (res_ptr, s1_ptr, s1_size, s2_limb)
return 0;
}
_EXTERN_INLINE mp_limb
_EXTERN_INLINE mp_limb_t
#if defined (__STDC__) || defined (__cplusplus)
mpn_sub (register mp_ptr res_ptr,
register mp_srcptr s1_ptr,
@ -541,7 +555,7 @@ mpn_sub (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
register mp_size_t s2_size;
#endif
{
mp_limb cy_limb = 0;
mp_limb_t cy_limb = 0;
if (s2_size != 0)
cy_limb = mpn_sub_n (res_ptr, s1_ptr, s2_ptr, s2_size);
@ -556,9 +570,9 @@ mpn_sub (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
#endif /* __GNUC__ */
/* Allow faster testing for negative, zero, and positive. */
#define mpz_sign(Z) ((Z)->_mp_size)
#define mpf_sign(F) ((F)->_mp_size)
#define mpq_sign(Q) ((Q)->_mp_num._mp_size)
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
/* Allow direct user access to numerator and denominator of a mpq_t object. */
#define mpq_numref(Q) (&((Q)->_mp_num))
@ -568,14 +582,14 @@ mpn_sub (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
#if defined (__GNUC__)
#define mpz_cmp_ui(Z,UI) \
(__builtin_constant_p (UI) && (UI) == 0 \
? mpz_sign (Z) : mpz_cmp_ui (Z,UI))
? mpz_sgn (Z) : mpz_cmp_ui (Z,UI))
#define mpz_cmp_si(Z,UI) \
(__builtin_constant_p (UI) && (UI) == 0 ? mpz_sign (Z) \
(__builtin_constant_p (UI) && (UI) == 0 ? mpz_sgn (Z) \
: __builtin_constant_p (UI) && (UI) > 0 ? mpz_cmp_ui (Z,UI) \
: mpz_cmp_si (Z,UI))
#define mpq_cmp_ui(Q,NUI,DUI) \
(__builtin_constant_p (NUI) && (NUI) == 0 \
? mpq_sign (Q) : mpq_cmp_ui (Q,NUI,DUI))
? mpq_sgn (Q) : mpq_cmp_ui (Q,NUI,DUI))
#endif
#define mpn_divmod(qp,np,nsize,dp,dsize) mpn_divrem (qp,0,np,nsize,dp,dsize)
@ -603,6 +617,6 @@ mpn_sub (res_ptr, s1_ptr, s1_size, s2_ptr, s2_size)
#define mpz_mod_2exp mpz_fdiv_r_2exp
#define __GNU_MP_VERSION 2
#define __GNU_MP_VERSION_MINOR -927 /* ??? */
#define __GNU_MP_VERSION_MINOR 0
#define __GMP_H__
#endif /* __GMP_H__ */

View file

@ -1,6 +1,6 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
@ -14,7 +14,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with this file; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* You have to define the following before including this file:
@ -35,6 +36,12 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1))
#define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2))
/* This is used to make sure no undesirable sharing between different libraries
that use this file takes place. */
#ifndef __MPN
#define __MPN(x) __##x
#endif
/* Define auxiliary asm macros.
1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two
@ -142,7 +149,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define COUNT_LEADING_ZEROS_0 32
#endif /* __a29k__ */
#if defined (__alpha__) && W_TYPE_SIZE == 64
#if defined (__alpha) && W_TYPE_SIZE == 64
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
@ -162,7 +169,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern UDItype __udiv_qrnnd ();
#define UDIV_TIME 220
#endif /* LONGLONG_STANDALONE */
#endif /* __alpha__ */
#endif /* __alpha */
#if defined (__arm__) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
@ -1070,6 +1077,9 @@ extern USItype __udiv_qrnnd ();
__asm__ ("scan %1,0,%0" \
: "=r" ((USItype)(x)) \
: "r" ((USItype)(count)))
/* Early sparclites return 63 for an argument of 0, but they warn that future
implementations might change this. Therefore, leave COUNT_LEADING_ZEROS_0
undefined. */
#endif /* __sparclite__ */
#endif /* __sparc_v8__ */
/* Default to sparc v7 versions of umul_ppmm and udiv_qrnnd. */
@ -1336,7 +1346,7 @@ extern USItype __udiv_qrnnd ();
#define udiv_qrnnd(q, r, nh, nl, d) \
do { \
UWtype __r; \
(q) = __udiv_w_sdiv (&__r, nh, nl, d); \
(q) = __MPN(udiv_w_sdiv) (&__r, nh, nl, d); \
(r) = __r; \
} while (0)
#endif

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#define BITS_PER_MP_LIMB 64
#define BYTES_PER_MP_LIMB 8

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
.set noreorder

View file

@ -16,12 +16,13 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
mp_limb
mp_limb_t
#if __STDC__
mpn_add_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size)
#else
@ -32,7 +33,7 @@ mpn_add_n (res_ptr, s1_ptr, s2_ptr, size)
mp_size_t size;
#endif
{
register mp_limb x, y, cy;
register mp_limb_t x, y, cy;
register mp_size_t j;
/* The loop counter and index J goes from -SIZE to -1. This way

View file

@ -19,23 +19,24 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
mp_limb
mp_limb_t
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;
register mp_limb s2_limb;
register mp_limb_t s2_limb;
{
register mp_limb cy_limb;
register mp_limb_t cy_limb;
register mp_size_t j;
register mp_limb prod_high, prod_low;
register mp_limb x;
register mp_limb_t prod_high, prod_low;
register mp_limb_t x;
/* The loop counter and index J goes from -SIZE to -1. This way
the loop becomes faster. */

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -37,7 +38,7 @@ mpn_cmp (op1_ptr, op2_ptr, size)
#endif
{
mp_size_t i;
mp_limb op1_word, op2_word;
mp_limb_t op1_word, op2_word;
for (i = size - 1; i >= 0; i--)
{

View file

@ -22,7 +22,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -39,21 +40,21 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* FIXME: We should be using invert_limb (or invert_normalized_limb)
here (not udiv_qrnnd). */
mp_limb
mp_limb_t
#if __STDC__
mpn_divmod_1 (mp_ptr quot_ptr,
mp_srcptr dividend_ptr, mp_size_t dividend_size,
mp_limb divisor_limb)
mp_limb_t divisor_limb)
#else
mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
mp_ptr quot_ptr;
mp_srcptr dividend_ptr;
mp_size_t dividend_size;
mp_limb divisor_limb;
mp_limb_t divisor_limb;
#endif
{
mp_size_t i;
mp_limb n1, n0, r;
mp_limb_t n1, n0, r;
int dummy;
/* ??? Should this be handled at all? Rely on callers? */
@ -75,7 +76,7 @@ mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
count_leading_zeros (normalization_steps, divisor_limb);
if (normalization_steps != 0)
{
mp_limb divisor_limb_inverted;
mp_limb_t divisor_limb_inverted;
divisor_limb <<= normalization_steps;
@ -85,7 +86,7 @@ mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
/* Special case for DIVISOR_LIMB == 100...000. */
if (divisor_limb << 1 == 0)
divisor_limb_inverted = ~(mp_limb) 0;
divisor_limb_inverted = ~(mp_limb_t) 0;
else
udiv_qrnnd (divisor_limb_inverted, dummy,
-divisor_limb, 0, divisor_limb);
@ -115,7 +116,7 @@ mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
}
else
{
mp_limb divisor_limb_inverted;
mp_limb_t divisor_limb_inverted;
/* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The
result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
@ -123,7 +124,7 @@ mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
/* Special case for DIVISOR_LIMB == 100...000. */
if (divisor_limb << 1 == 0)
divisor_limb_inverted = ~(mp_limb) 0;
divisor_limb_inverted = ~(mp_limb_t) 0;
else
udiv_qrnnd (divisor_limb_inverted, dummy,
-divisor_limb, 0, divisor_limb);

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -39,7 +40,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
remainder in NUM.
3. NSIZE >= DSIZE, even if QEXTRA_LIMBS is non-zero. */
mp_limb
mp_limb_t
#if __STDC__
mpn_divrem (mp_ptr qp, mp_size_t qextra_limbs,
mp_ptr np, mp_size_t nsize,
@ -54,7 +55,7 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
mp_size_t dsize;
#endif
{
mp_limb most_significant_q_limb = 0;
mp_limb_t most_significant_q_limb = 0;
switch (dsize)
{
@ -66,8 +67,8 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
case 1:
{
mp_size_t i;
mp_limb n1;
mp_limb d;
mp_limb_t n1;
mp_limb_t d;
d = dp[0];
n1 = np[nsize - 1];
@ -93,8 +94,8 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
case 2:
{
mp_size_t i;
mp_limb n1, n0, n2;
mp_limb d1, d0;
mp_limb_t n1, n0, n2;
mp_limb_t d1, d0;
np += nsize - 2;
d1 = dp[1];
@ -110,8 +111,8 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
for (i = qextra_limbs + nsize - 2 - 1; i >= 0; i--)
{
mp_limb q;
mp_limb r;
mp_limb_t q;
mp_limb_t r;
if (i >= qextra_limbs)
np--;
@ -123,7 +124,7 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
/* Q should be either 111..111 or 111..110. Need special
treatment of this rare case as normal division would
give overflow. */
q = ~(mp_limb) 0;
q = ~(mp_limb_t) 0;
r = n0 + d1;
if (r < d1) /* Carry in the addition? */
@ -165,7 +166,7 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
default:
{
mp_size_t i;
mp_limb dX, d1, n0;
mp_limb_t dX, d1, n0;
np += nsize - dsize;
dX = dp[dsize - 1];
@ -184,9 +185,9 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
for (i = qextra_limbs + nsize - dsize - 1; i >= 0; i--)
{
mp_limb q;
mp_limb n1, n2;
mp_limb cy_limb;
mp_limb_t q;
mp_limb_t n1, n2;
mp_limb_t cy_limb;
if (i >= qextra_limbs)
{
@ -203,10 +204,10 @@ mpn_divrem (qp, qextra_limbs, np, nsize, dp, dsize)
if (n0 == dX)
/* This might over-estimate q, but it's probably not worth
the extra code here to find out. */
q = ~(mp_limb) 0;
q = ~(mp_limb_t) 0;
else
{
mp_limb r;
mp_limb_t r;
udiv_qrnnd (q, r, n0, np[dsize - 1], dX);
umul_ppmm (n1, n0, d1, q);

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#define BITS_PER_MP_LIMB 32
#define BYTES_PER_MP_LIMB 4

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -30,7 +31,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
2. If the result is to be written over the input, WP must be >= UP.
*/
mp_limb
mp_limb_t
#if __STDC__
mpn_lshift (register mp_ptr wp,
register mp_srcptr up, mp_size_t usize,
@ -43,10 +44,10 @@ mpn_lshift (wp, up, usize, cnt)
register unsigned int cnt;
#endif
{
register mp_limb high_limb, low_limb;
register mp_limb_t high_limb, low_limb;
register unsigned sh_1, sh_2;
register mp_size_t i;
mp_limb retval;
mp_limb_t retval;
#ifdef DEBUG
if (usize == 0 || cnt == 0)

View file

@ -19,7 +19,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -36,19 +37,19 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* FIXME: We should be using invert_limb (or invert_normalized_limb)
here (not udiv_qrnnd). */
mp_limb
mp_limb_t
#if __STDC__
mpn_mod_1 (mp_srcptr dividend_ptr, mp_size_t dividend_size,
mp_limb divisor_limb)
mp_limb_t divisor_limb)
#else
mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
mp_srcptr dividend_ptr;
mp_size_t dividend_size;
mp_limb divisor_limb;
mp_limb_t divisor_limb;
#endif
{
mp_size_t i;
mp_limb n1, n0, r;
mp_limb_t n1, n0, r;
int dummy;
/* Botch: Should this be handled at all? Rely on callers? */
@ -70,7 +71,7 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
count_leading_zeros (normalization_steps, divisor_limb);
if (normalization_steps != 0)
{
mp_limb divisor_limb_inverted;
mp_limb_t divisor_limb_inverted;
divisor_limb <<= normalization_steps;
@ -80,7 +81,7 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
/* Special case for DIVISOR_LIMB == 100...000. */
if (divisor_limb << 1 == 0)
divisor_limb_inverted = ~(mp_limb) 0;
divisor_limb_inverted = ~(mp_limb_t) 0;
else
udiv_qrnnd (divisor_limb_inverted, dummy,
-divisor_limb, 0, divisor_limb);
@ -110,7 +111,7 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
}
else
{
mp_limb divisor_limb_inverted;
mp_limb_t divisor_limb_inverted;
/* Compute (2**2N - 2**N * DIVISOR_LIMB) / DIVISOR_LIMB. The
result is a (N+1)-bit approximation to 1/DIVISOR_LIMB, with the
@ -118,7 +119,7 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
/* Special case for DIVISOR_LIMB == 100...000. */
if (divisor_limb << 1 == 0)
divisor_limb_inverted = ~(mp_limb) 0;
divisor_limb_inverted = ~(mp_limb_t) 0;
else
udiv_qrnnd (divisor_limb_inverted, dummy,
-divisor_limb, 0, divisor_limb);

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -41,7 +42,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define KARATSUBA_THRESHOLD 32
#endif
mp_limb
mp_limb_t
#if __STDC__
mpn_mul (mp_ptr prodp,
mp_srcptr up, mp_size_t usize,
@ -56,7 +57,7 @@ mpn_mul (prodp, up, usize, vp, vsize)
#endif
{
mp_ptr prod_endp = prodp + usize + vsize - 1;
mp_limb cy;
mp_limb_t cy;
mp_ptr tspace;
TMP_DECL (marker);
@ -69,8 +70,8 @@ mpn_mul (prodp, up, usize, vp, vsize)
here immediately. Huge ones arrive here as this is the base case
for Karatsuba's recursive algorithm below. */
mp_size_t i;
mp_limb cy_limb;
mp_limb v_limb;
mp_limb_t cy_limb;
mp_limb_t v_limb;
if (vsize == 0)
return 0;

View file

@ -17,22 +17,23 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
mp_limb
mp_limb_t
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;
register mp_limb s2_limb;
register mp_limb_t s2_limb;
{
register mp_limb cy_limb;
register mp_limb_t cy_limb;
register mp_size_t j;
register mp_limb prod_high, prod_low;
register mp_limb_t prod_high, prod_low;
/* The loop counter and index J goes from -S1_SIZE to -1. This way
the loop becomes faster. */

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -60,8 +61,8 @@ impn_mul_n_basecase (prodp, up, vp, size)
#endif
{
mp_size_t i;
mp_limb cy_limb;
mp_limb v_limb;
mp_limb_t cy_limb;
mp_limb_t v_limb;
/* Multiply by the first limb in V separately, as the result can be
stored (not added) to PROD. We also avoid a loop for zeroing. */
@ -125,7 +126,7 @@ impn_mul_n (prodp, up, vp, size, tspace)
stack grow a lot less. */
mp_size_t esize = size - 1; /* even size */
mp_limb cy_limb;
mp_limb_t cy_limb;
MPN_MUL_N_RECURSE (prodp, up, vp, esize, tspace);
cy_limb = mpn_addmul_1 (prodp + esize, up, esize, vp[esize]);
@ -152,7 +153,7 @@ impn_mul_n (prodp, up, vp, size, tspace)
Where B = 2**BITS_PER_MP_LIMB. */
mp_size_t hsize = size >> 1;
mp_limb cy;
mp_limb_t cy;
int negflg;
/*** Product H. ________________ ________________
@ -229,8 +230,8 @@ impn_sqr_n_basecase (prodp, up, size)
#endif
{
mp_size_t i;
mp_limb cy_limb;
mp_limb v_limb;
mp_limb_t cy_limb;
mp_limb_t v_limb;
/* Multiply by the first limb in V separately, as the result can be
stored (not added) to PROD. We also avoid a loop for zeroing. */
@ -293,7 +294,7 @@ impn_sqr_n (prodp, up, size, tspace)
stack grow a lot less. */
mp_size_t esize = size - 1; /* even size */
mp_limb cy_limb;
mp_limb_t cy_limb;
MPN_SQR_N_RECURSE (prodp, up, esize, tspace);
cy_limb = mpn_addmul_1 (prodp + esize, up, esize, up[esize]);
@ -305,7 +306,7 @@ impn_sqr_n (prodp, up, size, tspace)
else
{
mp_size_t hsize = size >> 1;
mp_limb cy;
mp_limb_t cy;
/*** Product H. ________________ ________________
|_____U1 x U1____||____U0 x U0_____| */

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
@ -30,7 +31,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
2. If the result is to be written over the input, WP must be <= UP.
*/
mp_limb
mp_limb_t
#if __STDC__
mpn_rshift (register mp_ptr wp,
register mp_srcptr up, mp_size_t usize,
@ -43,10 +44,10 @@ mpn_rshift (wp, up, usize, cnt)
register unsigned int cnt;
#endif
{
register mp_limb high_limb, low_limb;
register mp_limb_t high_limb, low_limb;
register unsigned sh_1, sh_2;
register mp_size_t i;
mp_limb retval;
mp_limb_t retval;
#ifdef DEBUG
if (usize == 0 || cnt == 0)

View file

@ -16,12 +16,13 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
mp_limb
mp_limb_t
#if __STDC__
mpn_sub_n (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_srcptr s2_ptr, mp_size_t size)
#else
@ -32,7 +33,7 @@ mpn_sub_n (res_ptr, s1_ptr, s2_ptr, size)
mp_size_t size;
#endif
{
register mp_limb x, y, cy;
register mp_limb_t x, y, cy;
register mp_size_t j;
/* The loop counter and index J goes from -SIZE to -1. This way

View file

@ -19,23 +19,24 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
mp_limb
mp_limb_t
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;
register mp_limb s2_limb;
register mp_limb_t s2_limb;
{
register mp_limb cy_limb;
register mp_limb_t cy_limb;
register mp_size_t j;
register mp_limb prod_high, prod_low;
register mp_limb x;
register mp_limb_t prod_high, prod_low;
register mp_limb_t x;
/* The loop counter and index J goes from -SIZE to -1. This way
the loop becomes faster. */

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#define BITS_PER_MP_LIMB 32
#define BYTES_PER_MP_LIMB 4

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/*
INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
; You should have received a copy of the GNU Library General Public License
; along with the GNU MP Library; see the file COPYING.LIB. If not, write to
; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
; MA 02111-1307, USA.
; INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#define BITS_PER_MP_LIMB 64
#define BYTES_PER_MP_LIMB 8

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -1,6 +1,6 @@
# IBM POWER __mpn_add_n -- Add two limb vectors of equal, non-zero length.
# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
# Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS
@ -37,18 +38,44 @@ __mpn_add_n:
.long .__mpn_add_n, TOC[tc0], 0
.csect [PR]
.__mpn_add_n:
mtctr 6 # copy size into CTR
andil. 10,6,1 # odd or even number of limbs?
l 8,0(4) # load least significant s1 limb
l 0,0(5) # load least significant s2 limb
cal 3,-4(3) # offset res_ptr, it's updated before used
cal 3,-4(3) # offset res_ptr, it's updated before it's used
sri 10,6,1 # count for unrolled loop
a 7,0,8 # add least significant limbs, set cy
mtctr 10 # copy count into CTR
beq 0,Leven # branch if even # of limbs (# of limbs >= 2)
# We have an odd # of limbs. Add the first limbs separately.
cmpi 1,10,0 # is count for unrolled loop zero?
bne 1,L1 # branch if not
st 7,4(3)
aze 3,10 # use the fact that r10 is zero...
br # return
# We added least significant limbs. Now reload the next limbs to enter loop.
L1: lu 8,4(4) # load s1 limb and update s1_ptr
lu 0,4(5) # load s2 limb and update s2_ptr
stu 7,4(3)
ae 7,0,8 # add limbs, set cy
Leven: lu 9,4(4) # load s1 limb and update s1_ptr
lu 10,4(5) # load s2 limb and update s2_ptr
bdz Lend # If done, skip loop
Loop: lu 8,4(4) # load s1 limb and update s1_ptr
lu 0,4(5) # load s2 limb and update s2_ptr
stu 7,4(3) # store previous limb in load latency slot
ae 7,0,8 # add new limbs with cy, set cy
ae 11,9,10 # add previous limbs with cy, set cy
stu 7,4(3) #
lu 9,4(4) # load s1 limb and update s1_ptr
lu 10,4(5) # load s2 limb and update s2_ptr
ae 7,0,8 # add previous limbs with cy, set cy
stu 11,4(3) #
bdn Loop # decrement CTR and loop back
Lend: st 7,4(3) # store ultimate result limb
Lend: ae 11,9,10 # add limbs with cy, set cy
st 7,4(3) #
st 11,8(3) #
lil 3,0 # load cy into ...
aze 3,3 # ... return value register
br

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -1,7 +1,6 @@
# IBM POWER __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
# store difference in a third limb vector.
# IBM POWER __mpn_sub_n -- Subtract two limb vectors of equal, non-zero length.
# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
# Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
@ -17,7 +16,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS
@ -38,18 +38,45 @@ __mpn_sub_n:
.long .__mpn_sub_n, TOC[tc0], 0
.csect [PR]
.__mpn_sub_n:
mtctr 6 # copy size into CTR
andil. 10,6,1 # odd or even number of limbs?
l 8,0(4) # load least significant s1 limb
l 0,0(5) # load least significant s2 limb
cal 3,-4(3) # offset res_ptr, it's updated before used
sf 7,0,8 # add least significant limbs, set cy
cal 3,-4(3) # offset res_ptr, it's updated before it's used
sri 10,6,1 # count for unrolled loop
sf 7,0,8 # subtract least significant limbs, set cy
mtctr 10 # copy count into CTR
beq 0,Leven # branch if even # of limbs (# of limbs >= 2)
# We have an odd # of limbs. Add the first limbs separately.
cmpi 1,10,0 # is count for unrolled loop zero?
bne 1,L1 # branch if not
st 7,4(3)
sfe 3,0,0 # load !cy into ...
sfi 3,3,0 # ... return value register
br # return
# We added least significant limbs. Now reload the next limbs to enter loop.
L1: lu 8,4(4) # load s1 limb and update s1_ptr
lu 0,4(5) # load s2 limb and update s2_ptr
stu 7,4(3)
sfe 7,0,8 # subtract limbs, set cy
Leven: lu 9,4(4) # load s1 limb and update s1_ptr
lu 10,4(5) # load s2 limb and update s2_ptr
bdz Lend # If done, skip loop
Loop: lu 8,4(4) # load s1 limb and update s1_ptr
lu 0,4(5) # load s2 limb and update s2_ptr
stu 7,4(3) # store previous limb in load latency slot
sfe 7,0,8 # add new limbs with cy, set cy
sfe 11,10,9 # subtract previous limbs with cy, set cy
stu 7,4(3) #
lu 9,4(4) # load s1 limb and update s1_ptr
lu 10,4(5) # load s2 limb and update s2_ptr
sfe 7,0,8 # subtract previous limbs with cy, set cy
stu 11,4(3) #
bdn Loop # decrement CTR and loop back
Lend: st 7,4(3) # store ultimate result limb
Lend: sfe 11,10,9 # subtract limbs with cy, set cy
st 7,4(3) #
st 11,8(3) #
sfe 3,0,0 # load !cy into ...
sfi 3,3,0 # ... return value register
br

View file

@ -17,7 +17,8 @@
# You should have received a copy of the GNU Library General Public License
# along with the GNU MP Library; see the file COPYING.LIB. If not, write to
# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
# INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -16,7 +16,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -16,7 +16,8 @@ License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
#define BITS_PER_MP_LIMB 64
#define BYTES_PER_MP_LIMB 8

View file

@ -16,7 +16,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

View file

@ -17,7 +17,8 @@
! You should have received a copy of the GNU Library General Public License
! along with the GNU MP Library; see the file COPYING.LIB. If not, write to
! the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
! MA 02111-1307, USA.
! INPUT PARAMETERS

Some files were not shown because too many files have changed in this diff Show more