w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

mini-gmp.c File Reference
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mini-gmp.h"
Include dependency graph for mini-gmp.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gmp_div_inverse
 
struct  mpn_base_info
 

Macros

#define GMP_LIMB_BITS   (sizeof(mp_limb_t) * CHAR_BIT)
 
#define GMP_LIMB_MAX   ((mp_limb_t) ~ (mp_limb_t) 0)
 
#define GMP_LIMB_HIGHBIT   ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
 
#define GMP_HLIMB_BIT   ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
 
#define GMP_LLIMB_MASK   (GMP_HLIMB_BIT - 1)
 
#define GMP_ULONG_BITS   (sizeof(unsigned long) * CHAR_BIT)
 
#define GMP_ULONG_HIGHBIT   ((unsigned long) 1 << (GMP_ULONG_BITS - 1))
 
#define GMP_ABS(x)   ((x) >= 0 ? (x) : -(x))
 
#define GMP_NEG_CAST(T, x)   (-((T)((x) + 1) - 1))
 
#define GMP_MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define GMP_MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define GMP_CMP(a, b)   (((a) > (b)) - ((a) < (b)))
 
#define GMP_DBL_MANT_BITS   (53)
 
#define GMP_MPN_OVERLAP_P(xp, xsize, yp, ysize)    ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
 
#define gmp_assert_nocarry(x)
 
#define gmp_clz(count, x)
 
#define gmp_ctz(count, x)
 
#define gmp_add_ssaaaa(sh, sl, ah, al, bh, bl)
 
#define gmp_sub_ddmmss(sh, sl, ah, al, bh, bl)
 
#define gmp_umul_ppmm(w1, w0, u, v)
 
#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di)
 
#define gmp_udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv)
 
#define MP_LIMB_T_SWAP(x, y)
 
#define MP_SIZE_T_SWAP(x, y)
 
#define MP_BITCNT_T_SWAP(x, y)
 
#define MP_PTR_SWAP(x, y)
 
#define MP_SRCPTR_SWAP(x, y)
 
#define MPN_PTR_SWAP(xp, xs, yp, ys)
 
#define MPN_SRCPTR_SWAP(xp, xs, yp, ys)
 
#define MPZ_PTR_SWAP(x, y)
 
#define MPZ_SRCPTR_SWAP(x, y)
 
#define gmp_xalloc(size)   ((*gmp_allocate_func)((size)))
 
#define gmp_free(p)   ((*gmp_free_func) ((p), 0))
 
#define MPZ_REALLOC(z, n)
 
#define GMP_PRIME_PRODUCT    (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL)
 
#define GMP_PRIME_MASK   0xc96996dcUL
 

Enumerations

enum  mpz_div_round_mode { GMP_DIV_FLOOR , GMP_DIV_CEIL , GMP_DIV_TRUNC }
 

Functions

static void gmp_die (const char *msg)
 
static voidgmp_default_alloc (size_t size)
 
static voidgmp_default_realloc (void *old, size_t unused_old_size, size_t new_size)
 
static void gmp_default_free (void *p, size_t unused_size)
 
void mp_get_memory_functions (void *(**alloc_func)(size_t), void *(**realloc_func)(void *, size_t, size_t), void(**free_func)(void *, size_t))
 
void mp_set_memory_functions (void *(*alloc_func)(size_t), void *(*realloc_func)(void *, size_t, size_t), void(*free_func)(void *, size_t))
 
static mp_ptr gmp_xalloc_limbs (mp_size_t size)
 
static mp_ptr gmp_xrealloc_limbs (mp_ptr old, mp_size_t size)
 
void mpn_copyi (mp_ptr d, mp_srcptr s, mp_size_t n)
 
void mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n)
 
int mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
 
static int mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
 
static mp_size_t mpn_normalized_size (mp_srcptr xp, mp_size_t n)
 
int mpn_zero_p (mp_srcptr rp, mp_size_t n)
 
void mpn_zero (mp_ptr rp, mp_size_t n)
 
mp_limb_t mpn_add_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
 
mp_limb_t mpn_add_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
 
mp_limb_t mpn_add (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
 
mp_limb_t mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
 
mp_limb_t mpn_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
 
mp_limb_t mpn_sub (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
 
mp_limb_t mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
 
mp_limb_t mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
 
mp_limb_t mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
 
mp_limb_t mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
 
void mpn_mul_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
 
void mpn_sqr (mp_ptr rp, mp_srcptr ap, mp_size_t n)
 
mp_limb_t mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
 
mp_limb_t mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
 
static mp_bitcnt_t mpn_common_scan (mp_limb_t limb, mp_size_t i, mp_srcptr up, mp_size_t un, mp_limb_t ux)
 
mp_bitcnt_t mpn_scan1 (mp_srcptr ptr, mp_bitcnt_t bit)
 
mp_bitcnt_t mpn_scan0 (mp_srcptr ptr, mp_bitcnt_t bit)
 
void mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
 
mp_limb_t mpn_neg (mp_ptr rp, mp_srcptr up, mp_size_t n)
 
mp_limb_t mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
 
static void mpn_div_qr_1_invert (struct gmp_div_inverse *inv, mp_limb_t d)
 
static void mpn_div_qr_2_invert (struct gmp_div_inverse *inv, mp_limb_t d1, mp_limb_t d0)
 
static void mpn_div_qr_invert (struct gmp_div_inverse *inv, mp_srcptr dp, mp_size_t dn)
 
static mp_limb_t mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn, const struct gmp_div_inverse *inv)
 
static void mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn, const struct gmp_div_inverse *inv)
 
static void mpn_div_qr_pi1 (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_limb_t n1, mp_srcptr dp, mp_size_t dn, mp_limb_t dinv)
 
static void mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, const struct gmp_div_inverse *inv)
 
static void mpn_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
 
static unsigned mpn_base_power_of_two_p (unsigned b)
 
static void mpn_get_base_info (struct mpn_base_info *info, mp_limb_t b)
 
static mp_bitcnt_t mpn_limb_size_in_base_2 (mp_limb_t u)
 
static size_t mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un)
 
static size_t mpn_limb_get_str (unsigned char *sp, mp_limb_t w, const struct gmp_div_inverse *binv)
 
static size_t mpn_get_str_other (unsigned char *sp, int base, const struct mpn_base_info *info, mp_ptr up, mp_size_t un)
 
size_t mpn_get_str (unsigned char *sp, int base, mp_ptr up, mp_size_t un)
 
static mp_size_t mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn, unsigned bits)
 
static mp_size_t mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn, mp_limb_t b, const struct mpn_base_info *info)
 
mp_size_t mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base)
 
void mpz_init (mpz_t r)
 
void mpz_init2 (mpz_t r, mp_bitcnt_t bits)
 
void mpz_clear (mpz_t r)
 
static mp_ptr mpz_realloc (mpz_t r, mp_size_t size)
 
void mpz_set_si (mpz_t r, signed long int x)
 
void mpz_set_ui (mpz_t r, unsigned long int x)
 
void mpz_set (mpz_t r, const mpz_t x)
 
void mpz_init_set_si (mpz_t r, signed long int x)
 
void mpz_init_set_ui (mpz_t r, unsigned long int x)
 
void mpz_init_set (mpz_t r, const mpz_t x)
 
int mpz_fits_slong_p (const mpz_t u)
 
static int mpn_absfits_ulong_p (mp_srcptr up, mp_size_t un)
 
int mpz_fits_ulong_p (const mpz_t u)
 
long int mpz_get_si (const mpz_t u)
 
unsigned long int mpz_get_ui (const mpz_t u)
 
size_t mpz_size (const mpz_t u)
 
mp_limb_t mpz_getlimbn (const mpz_t u, mp_size_t n)
 
void mpz_realloc2 (mpz_t x, mp_bitcnt_t n)
 
mp_srcptr mpz_limbs_read (mpz_srcptr x)
 
mp_ptr mpz_limbs_modify (mpz_t x, mp_size_t n)
 
mp_ptr mpz_limbs_write (mpz_t x, mp_size_t n)
 
void mpz_limbs_finish (mpz_t x, mp_size_t xs)
 
static mpz_srcptr mpz_roinit_normal_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
 
mpz_srcptr mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs)
 
void mpz_set_d (mpz_t r, double x)
 
void mpz_init_set_d (mpz_t r, double x)
 
double mpz_get_d (const mpz_t u)
 
int mpz_cmpabs_d (const mpz_t x, double d)
 
int mpz_cmp_d (const mpz_t x, double d)
 
int mpz_sgn (const mpz_t u)
 
int mpz_cmp_si (const mpz_t u, long v)
 
int mpz_cmp_ui (const mpz_t u, unsigned long v)
 
int mpz_cmp (const mpz_t a, const mpz_t b)
 
int mpz_cmpabs_ui (const mpz_t u, unsigned long v)
 
int mpz_cmpabs (const mpz_t u, const mpz_t v)
 
void mpz_abs (mpz_t r, const mpz_t u)
 
void mpz_neg (mpz_t r, const mpz_t u)
 
void mpz_swap (mpz_t u, mpz_t v)
 
void mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
 
void mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
 
void mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
 
static mp_size_t mpz_abs_add (mpz_t r, const mpz_t a, const mpz_t b)
 
static mp_size_t mpz_abs_sub (mpz_t r, const mpz_t a, const mpz_t b)
 
void mpz_add (mpz_t r, const mpz_t a, const mpz_t b)
 
void mpz_sub (mpz_t r, const mpz_t a, const mpz_t b)
 
void mpz_mul_si (mpz_t r, const mpz_t u, long int v)
 
void mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 
void mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
 
void mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
 
void mpz_addmul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 
void mpz_submul_ui (mpz_t r, const mpz_t u, unsigned long int v)
 
void mpz_addmul (mpz_t r, const mpz_t u, const mpz_t v)
 
void mpz_submul (mpz_t r, const mpz_t u, const mpz_t v)
 
static int mpz_div_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d, enum mpz_div_round_mode mode)
 
void mpz_cdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
 
void mpz_fdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
 
void mpz_tdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
 
void mpz_cdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
 
void mpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
 
void mpz_tdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
 
void mpz_cdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
 
void mpz_fdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
 
void mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
 
void mpz_mod (mpz_t r, const mpz_t n, const mpz_t d)
 
static void mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index, enum mpz_div_round_mode mode)
 
static void mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index, enum mpz_div_round_mode mode)
 
void mpz_cdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
 
void mpz_fdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
 
void mpz_tdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
 
void mpz_cdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
 
void mpz_fdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
 
void mpz_tdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
 
void mpz_divexact (mpz_t q, const mpz_t n, const mpz_t d)
 
int mpz_divisible_p (const mpz_t n, const mpz_t d)
 
int mpz_congruent_p (const mpz_t a, const mpz_t b, const mpz_t m)
 
static unsigned long mpz_div_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d, enum mpz_div_round_mode mode)
 
unsigned long mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
 
unsigned long mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
 
unsigned long mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
 
unsigned long mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
 
unsigned long mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
 
unsigned long mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
 
unsigned long mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
 
unsigned long mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
 
unsigned long mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
 
unsigned long mpz_cdiv_ui (const mpz_t n, unsigned long d)
 
unsigned long mpz_fdiv_ui (const mpz_t n, unsigned long d)
 
unsigned long mpz_tdiv_ui (const mpz_t n, unsigned long d)
 
unsigned long mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d)
 
void mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d)
 
int mpz_divisible_ui_p (const mpz_t n, unsigned long d)
 
static mp_limb_t mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
 
unsigned long mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
 
static mp_bitcnt_t mpz_make_odd (mpz_t r)
 
void mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
 
void mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
 
void mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v)
 
void mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v)
 
int mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
 
void mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
 
void mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
 
void mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
 
void mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
 
void mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
 
int mpz_root (mpz_t x, const mpz_t y, unsigned long z)
 
void mpz_sqrtrem (mpz_t s, mpz_t r, const mpz_t u)
 
void mpz_sqrt (mpz_t s, const mpz_t u)
 
int mpz_perfect_square_p (const mpz_t u)
 
int mpn_perfect_square_p (mp_srcptr p, mp_size_t n)
 
mp_size_t mpn_sqrtrem (mp_ptr sp, mp_ptr rp, mp_srcptr p, mp_size_t n)
 
void mpz_mfac_uiui (mpz_t x, unsigned long n, unsigned long m)
 
void mpz_2fac_ui (mpz_t x, unsigned long n)
 
void mpz_fac_ui (mpz_t x, unsigned long n)
 
void mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
 
static int gmp_jacobi_coprime (mp_limb_t a, mp_limb_t b)
 
static void gmp_lucas_step_k_2k (mpz_t V, mpz_t Qk, const mpz_t n)
 
static int gmp_lucas_mod (mpz_t V, mpz_t Qk, long Q, mp_bitcnt_t b0, const mpz_t n)
 
static int gmp_stronglucas (const mpz_t x, mpz_t Qk)
 
static int gmp_millerrabin (const mpz_t n, const mpz_t nm1, mpz_t y, const mpz_t q, mp_bitcnt_t k)
 
int mpz_probab_prime_p (const mpz_t n, int reps)
 
int mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
 
static void mpz_abs_add_bit (mpz_t d, mp_bitcnt_t bit_index)
 
static void mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index)
 
void mpz_setbit (mpz_t d, mp_bitcnt_t bit_index)
 
void mpz_clrbit (mpz_t d, mp_bitcnt_t bit_index)
 
void mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
 
void mpz_com (mpz_t r, const mpz_t u)
 
void mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
 
void mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
 
void mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
 
static unsigned gmp_popcount_limb (mp_limb_t x)
 
mp_bitcnt_t mpn_popcount (mp_srcptr p, mp_size_t n)
 
mp_bitcnt_t mpz_popcount (const mpz_t u)
 
mp_bitcnt_t mpz_hamdist (const mpz_t u, const mpz_t v)
 
mp_bitcnt_t mpz_scan1 (const mpz_t u, mp_bitcnt_t starting_bit)
 
mp_bitcnt_t mpz_scan0 (const mpz_t u, mp_bitcnt_t starting_bit)
 
size_t mpz_sizeinbase (const mpz_t u, int base)
 
char * mpz_get_str (char *sp, int base, const mpz_t u)
 
int mpz_set_str (mpz_t r, const char *sp, int base)
 
int mpz_init_set_str (mpz_t r, const char *sp, int base)
 
size_t mpz_out_str (FILE *stream, int base, const mpz_t x)
 
static int gmp_detect_endian (void)
 
void mpz_import (mpz_t r, size_t count, int order, size_t size, int endian, size_t nails, const void *src)
 
voidmpz_export (void *r, size_t *countp, int order, size_t size, int endian, size_t nails, const mpz_t u)
 

Variables

const int mp_bits_per_limb = (sizeof(mp_limb_t) * 8 )
 
static void *(* gmp_allocate_func )(size_t) = gmp_default_alloc
 
static void *(* gmp_reallocate_func )(void *, size_t, size_t) = gmp_default_realloc
 
static void(* gmp_free_func )(void *, size_t) = gmp_default_free
 

Macro Definition Documentation

◆ GMP_ABS

#define GMP_ABS (   x)    ((x) >= 0 ? (x) : -(x))

Definition at line 70 of file mini-gmp.c.

◆ gmp_add_ssaaaa

#define gmp_add_ssaaaa (   sh,
  sl,
  ah,
  al,
  bh,
  bl 
)
Value:
do { \
mp_limb_t __x; \
__x = (al) + (bl); \
(sh) = (ah) + (bh) + (__x < (al)); \
(sl) = __x; \
} while (0)

Definition at line 116 of file mini-gmp.c.

◆ gmp_assert_nocarry

#define gmp_assert_nocarry (   x)
Value:
do { \
mp_limb_t __cy = (x); \
assert (__cy == 0); \
} while (0)
float x
Definition: cordic.py:15

Definition at line 90 of file mini-gmp.c.

◆ gmp_clz

#define gmp_clz (   count,
  x 
)
Value:
do { \
mp_limb_t __clz_x = (x); \
unsigned __clz_c = 0; \
int LOCAL_SHIFT_BITS = 8; \
if (GMP_LIMB_BITS > LOCAL_SHIFT_BITS) \
for (; \
(__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0; \
__clz_c += 8) \
{ __clz_x <<= LOCAL_SHIFT_BITS; } \
for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++) \
__clz_x <<= 1; \
(count) = __clz_c; \
} while (0)
#define count(a)
Definition: aptex-macros.h:781
unsigned long long int mp_limb_t
Definition: gmp.h:138
#define GMP_LIMB_HIGHBIT
Definition: mini-gmp.c:62
#define GMP_LIMB_BITS
Definition: mini-gmp.c:59

Definition at line 95 of file mini-gmp.c.

◆ GMP_CMP

#define GMP_CMP (   a,
  b 
)    (((a) > (b)) - ((a) < (b)))

Definition at line 76 of file mini-gmp.c.

◆ gmp_ctz

#define gmp_ctz (   count,
  x 
)
Value:
do { \
mp_limb_t __ctz_x = (x); \
unsigned __ctz_c = 0; \
gmp_clz (__ctz_c, __ctz_x & - __ctz_x); \
(count) = GMP_LIMB_BITS - 1 - __ctz_c; \
} while (0)

Definition at line 109 of file mini-gmp.c.

◆ GMP_DBL_MANT_BITS

#define GMP_DBL_MANT_BITS   (53)

Definition at line 81 of file mini-gmp.c.

◆ gmp_free

#define gmp_free (   p)    ((*gmp_free_func) ((p), 0))

Definition at line 355 of file mini-gmp.c.

◆ GMP_HLIMB_BIT

#define GMP_HLIMB_BIT   ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))

Definition at line 64 of file mini-gmp.c.

◆ GMP_LIMB_BITS

#define GMP_LIMB_BITS   (sizeof(mp_limb_t) * CHAR_BIT)

Definition at line 59 of file mini-gmp.c.

◆ GMP_LIMB_HIGHBIT

#define GMP_LIMB_HIGHBIT   ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))

Definition at line 62 of file mini-gmp.c.

◆ GMP_LIMB_MAX

#define GMP_LIMB_MAX   ((mp_limb_t) ~ (mp_limb_t) 0)

Definition at line 61 of file mini-gmp.c.

◆ GMP_LLIMB_MASK

#define GMP_LLIMB_MASK   (GMP_HLIMB_BIT - 1)

Definition at line 65 of file mini-gmp.c.

◆ GMP_MAX

#define GMP_MAX (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 74 of file mini-gmp.c.

◆ GMP_MIN

#define GMP_MIN (   a,
  b 
)    ((a) < (b) ? (a) : (b))

Definition at line 73 of file mini-gmp.c.

◆ GMP_MPN_OVERLAP_P

#define GMP_MPN_OVERLAP_P (   xp,
  xsize,
  yp,
  ysize 
)     ((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))

Definition at line 87 of file mini-gmp.c.

◆ GMP_NEG_CAST

#define GMP_NEG_CAST (   T,
  x 
)    (-((T)((x) + 1) - 1))

Definition at line 71 of file mini-gmp.c.

◆ GMP_PRIME_MASK

#define GMP_PRIME_MASK   0xc96996dcUL

Definition at line 3536 of file mini-gmp.c.

◆ GMP_PRIME_PRODUCT

#define GMP_PRIME_PRODUCT    (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL)

Definition at line 3532 of file mini-gmp.c.

◆ gmp_sub_ddmmss

#define gmp_sub_ddmmss (   sh,
  sl,
  ah,
  al,
  bh,
  bl 
)
Value:
do { \
mp_limb_t __x; \
__x = (al) - (bl); \
(sh) = (ah) - (bh) - ((al) < (bl)); \
(sl) = __x; \
} while (0)

Definition at line 124 of file mini-gmp.c.

◆ gmp_udiv_qr_3by2

#define gmp_udiv_qr_3by2 (   q,
  r1,
  r0,
  n2,
  n1,
  n0,
  d1,
  d0,
  dinv 
)
Value:
do { \
mp_limb_t _q0, _t1, _t0, _mask; \
gmp_umul_ppmm ((q), _q0, (n2), (dinv)); \
gmp_add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \
\
/* Compute the two most significant limbs of n - q'd */ \
(r1) = (n1) - (d1) * (q); \
gmp_sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0)); \
gmp_umul_ppmm (_t1, _t0, (d0), (q)); \
gmp_sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0); \
(q)++; \
\
/* Conditionally adjust q and the remainders */ \
_mask = - (mp_limb_t) ((r1) >= _q0); \
(q) += _mask; \
gmp_add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
if ((r1) >= (d1)) \
{ \
if ((r1) > (d1) || (r0) >= (d0)) \
{ \
(q)++; \
gmp_sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \
} \
} \
} while (0)
q
Definition: afm2pl.c:2287
#define r1
#define r0
d0
Definition: sec_div.c:122
d1
Definition: sec_div.c:81
RETTYPE mp_ptr mp_size_t mp_srcptr mp_size_t mp_limb_t dinv
Definition: sec_pi1_div.c:81

Definition at line 191 of file mini-gmp.c.

◆ gmp_udiv_qrnnd_preinv

#define gmp_udiv_qrnnd_preinv (   q,
  r,
  nh,
  nl,
  d,
  di 
)
Value:
do { \
mp_limb_t _qh, _ql, _r, _mask; \
gmp_umul_ppmm (_qh, _ql, (nh), (di)); \
gmp_add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
_r = (nl) - _qh * (d); \
_mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \
_qh += _mask; \
_r += _mask & (d); \
if (_r >= (d)) \
{ \
_r -= (d); \
_qh++; \
} \
\
(r) = _r; \
(q) = _qh; \
} while (0)
int nl
Definition: afm2tfm.c:885
int nh
Definition: afm2tfm.c:885
#define d(n)
Definition: gpos-common.c:151
int r
Definition: ppmqvga.c:68

Definition at line 172 of file mini-gmp.c.

◆ GMP_ULONG_BITS

#define GMP_ULONG_BITS   (sizeof(unsigned long) * CHAR_BIT)

Definition at line 67 of file mini-gmp.c.

◆ GMP_ULONG_HIGHBIT

#define GMP_ULONG_HIGHBIT   ((unsigned long) 1 << (GMP_ULONG_BITS - 1))

Definition at line 68 of file mini-gmp.c.

◆ gmp_umul_ppmm

#define gmp_umul_ppmm (   w1,
  w0,
  u,
  v 
)

Definition at line 132 of file mini-gmp.c.

◆ gmp_xalloc

#define gmp_xalloc (   size)    ((*gmp_allocate_func)((size)))

Definition at line 354 of file mini-gmp.c.

◆ MP_BITCNT_T_SWAP

#define MP_BITCNT_T_SWAP (   x,
  y 
)
Value:
do { \
mp_bitcnt_t __mp_bitcnt_t_swap__tmp = (x); \
(x) = (y); \
(y) = __mp_bitcnt_t_swap__tmp; \
} while (0)
kerning y
Definition: ttdriver.c:212

Definition at line 231 of file mini-gmp.c.

◆ MP_LIMB_T_SWAP

#define MP_LIMB_T_SWAP (   x,
  y 
)
Value:
do { \
mp_limb_t __mp_limb_t_swap__tmp = (x); \
(x) = (y); \
(y) = __mp_limb_t_swap__tmp; \
} while (0)

Definition at line 219 of file mini-gmp.c.

◆ MP_PTR_SWAP

#define MP_PTR_SWAP (   x,
  y 
)
Value:
do { \
mp_ptr __mp_ptr_swap__tmp = (x); \
(x) = (y); \
(y) = __mp_ptr_swap__tmp; \
} while (0)

Definition at line 237 of file mini-gmp.c.

◆ MP_SIZE_T_SWAP

#define MP_SIZE_T_SWAP (   x,
  y 
)
Value:
do { \
mp_size_t __mp_size_t_swap__tmp = (x); \
(x) = (y); \
(y) = __mp_size_t_swap__tmp; \
} while (0)

Definition at line 225 of file mini-gmp.c.

◆ MP_SRCPTR_SWAP

#define MP_SRCPTR_SWAP (   x,
  y 
)
Value:
do { \
mp_srcptr __mp_srcptr_swap__tmp = (x); \
(x) = (y); \
(y) = __mp_srcptr_swap__tmp; \
} while (0)

Definition at line 243 of file mini-gmp.c.

◆ MPN_PTR_SWAP

#define MPN_PTR_SWAP (   xp,
  xs,
  yp,
  ys 
)
Value:
do { \
MP_PTR_SWAP (xp, yp); \
MP_SIZE_T_SWAP (xs, ys); \
} while(0)
#define xp

Definition at line 250 of file mini-gmp.c.

◆ MPN_SRCPTR_SWAP

#define MPN_SRCPTR_SWAP (   xp,
  xs,
  yp,
  ys 
)
Value:
do { \
MP_SRCPTR_SWAP (xp, yp); \
MP_SIZE_T_SWAP (xs, ys); \
} while(0)

Definition at line 255 of file mini-gmp.c.

◆ MPZ_PTR_SWAP

#define MPZ_PTR_SWAP (   x,
  y 
)
Value:
do { \
mpz_ptr __mpz_ptr_swap__tmp = (x); \
(x) = (y); \
(y) = __mpz_ptr_swap__tmp; \
} while (0)

Definition at line 261 of file mini-gmp.c.

◆ MPZ_REALLOC

#define MPZ_REALLOC (   z,
  n 
)
Value:
((n) > (z)->_mp_alloc \
: (z)->_mp_d)
#define n
Definition: t4ht.c:1290
int z
Definition: dviconv.c:26
static mp_ptr mpz_realloc(mpz_t r, mp_size_t size)
Definition: mini-gmp.c:1442

Definition at line 1459 of file mini-gmp.c.

◆ MPZ_SRCPTR_SWAP

#define MPZ_SRCPTR_SWAP (   x,
  y 
)
Value:
do { \
mpz_srcptr __mpz_srcptr_swap__tmp = (x); \
(x) = (y); \
(y) = __mpz_srcptr_swap__tmp; \
} while (0)

Definition at line 267 of file mini-gmp.c.

Enumeration Type Documentation

◆ mpz_div_round_mode

Enumerator
GMP_DIV_FLOOR 
GMP_DIV_CEIL 
GMP_DIV_TRUNC 

Definition at line 2148 of file mini-gmp.c.

Function Documentation

◆ gmp_default_alloc()

static void* gmp_default_alloc ( size_t  size)
static

Definition at line 286 of file mini-gmp.c.

References assert(), gmp_die(), malloc, p, and size.

Referenced by mp_set_memory_functions().

◆ gmp_default_free()

static void gmp_default_free ( void p,
size_t  unused_size 
)
static

Definition at line 313 of file mini-gmp.c.

References free, and p.

Referenced by mp_set_memory_functions().

◆ gmp_default_realloc()

static void* gmp_default_realloc ( void old,
size_t  unused_old_size,
size_t  new_size 
)
static

Definition at line 300 of file mini-gmp.c.

References gmp_die(), new_size(), p, and realloc.

Referenced by mp_set_memory_functions().

◆ gmp_detect_endian()

static int gmp_detect_endian ( void  )
static

Definition at line 4394 of file mini-gmp.c.

References i, and p.

Referenced by mpz_export(), and mpz_import().

◆ gmp_die()

static void gmp_die ( const char *  msg)
static

◆ gmp_jacobi_coprime()

static int gmp_jacobi_coprime ( mp_limb_t  a,
mp_limb_t  b 
)
static

Definition at line 3338 of file mini-gmp.c.

References a, assert(), b, c, and gmp_ctz.

◆ gmp_lucas_mod()

◆ gmp_lucas_step_k_2k()

static void gmp_lucas_step_k_2k ( mpz_t  V,
mpz_t  Qk,
const mpz_t  n 
)
static

Definition at line 3379 of file mini-gmp.c.

References mpz_mod(), mpz_mul(), mpz_submul_ui(), mpz_tdiv_r(), n, and V.

Referenced by gmp_lucas_mod().

◆ gmp_millerrabin()

static int gmp_millerrabin ( const mpz_t  n,
const mpz_t  nm1,
mpz_t  y,
const mpz_t  q,
mp_bitcnt_t  k 
)
static

Definition at line 3506 of file mini-gmp.c.

References assert(), k, mpz_cmp(), mpz_cmp_ui(), mpz_powm(), mpz_powm_ui(), n, q, and y.

Referenced by mpz_probab_prime_p().

◆ gmp_popcount_limb()

static unsigned gmp_popcount_limb ( mp_limb_t  x)
static

Definition at line 3979 of file mini-gmp.c.

References c, GMP_LIMB_BITS, w, and cordic::x.

Referenced by mpn_popcount(), and mpz_hamdist().

◆ gmp_stronglucas()

static int gmp_stronglucas ( const mpz_t  x,
mpz_t  Qk 
)
static

Definition at line 3453 of file mini-gmp.c.

References assert(), b0, D, GMP_ABS, GMP_LIMB_MAX, if, mpz_odd_p, mpz_roinit_normal_n(), mpz_root(), mpz_tdiv_ui(), n, V, and cordic::x.

Referenced by mpz_probab_prime_p().

◆ gmp_xalloc_limbs()

static mp_ptr gmp_xalloc_limbs ( mp_size_t  size)
static

Definition at line 358 of file mini-gmp.c.

References gmp_xalloc, and size.

Referenced by mpn_div_qr(), mpn_div_qr_1_preinv(), mpz_get_str(), mpz_init2(), mpz_powm(), mpz_realloc(), and mpz_sizeinbase().

◆ gmp_xrealloc_limbs()

static mp_ptr gmp_xrealloc_limbs ( mp_ptr  old,
mp_size_t  size 
)
static

Definition at line 364 of file mini-gmp.c.

References assert(), and size.

Referenced by mpz_realloc().

◆ mp_get_memory_functions()

void mp_get_memory_functions ( void *(**)(size_t alloc_func,
void *(**)(void *, size_t, size_t realloc_func,
void(**)(void *, size_t free_func 
)

Definition at line 323 of file mini-gmp.c.

References gmp_allocate_func, gmp_free_func, and gmp_reallocate_func.

◆ mp_set_memory_functions()

void mp_set_memory_functions ( void *(*)(size_t alloc_func,
void *(*)(void *, size_t, size_t realloc_func,
void(*)(void *, size_t free_func 
)

◆ mpn_absfits_ulong_p()

static int mpn_absfits_ulong_p ( mp_srcptr  up,
mp_size_t  un 
)
static

Definition at line 1549 of file mini-gmp.c.

References GMP_LIMB_BITS, GMP_ULONG_BITS, ULONG_MAX, and up.

Referenced by mpz_cmpabs_ui(), and mpz_fits_ulong_p().

◆ mpn_add()

mp_limb_t mpn_add ( mp_ptr  rp,
mp_srcptr  ap,
mp_size_t  an,
mp_srcptr  bp,
mp_size_t  bn 
)

Definition at line 468 of file mini-gmp.c.

References ap, assert(), bp, cy, mpn_add_1(), mpn_add_n(), and rp.

Referenced by mpz_abs_add().

◆ mpn_add_1()

mp_limb_t mpn_add_1 ( mp_ptr  rp,
mp_srcptr  ap,
mp_size_t  n,
mp_limb_t  b 
)

Definition at line 430 of file mini-gmp.c.

References ap, assert(), b, i, n, r, and rp.

Referenced by mpn_add(), mpn_set_str_other(), and mpz_abs_add_bit().

◆ mpn_add_n()

mp_limb_t mpn_add_n ( mp_ptr  rp,
mp_srcptr  ap,
mp_srcptr  bp,
mp_size_t  n 
)

Definition at line 449 of file mini-gmp.c.

References a, ap, b, bp, cy, i, n, r, and rp.

Referenced by mpn_add(), and mpn_div_qr_pi1().

◆ mpn_addmul_1()

mp_limb_t mpn_addmul_1 ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n,
mp_limb_t  vl 
)

Definition at line 556 of file mini-gmp.c.

References assert(), gmp_umul_ppmm, n, gen-ragel-artifacts::rl, rp, and up.

Referenced by mpn_mul().

◆ mpn_base_power_of_two_p()

static unsigned mpn_base_power_of_two_p ( unsigned  b)
static

Definition at line 1151 of file mini-gmp.c.

References b.

Referenced by mpn_get_str(), mpn_set_str(), mpz_get_str(), and mpz_set_str().

◆ mpn_cmp()

int mpn_cmp ( mp_srcptr  ap,
mp_srcptr  bp,
mp_size_t  n 
)

Definition at line 389 of file mini-gmp.c.

References ap, bp, and n.

Referenced by mpn_cmp4(), and mpz_cmp().

◆ mpn_cmp4()

static int mpn_cmp4 ( mp_srcptr  ap,
mp_size_t  an,
mp_srcptr  bp,
mp_size_t  bn 
)
static

Definition at line 400 of file mini-gmp.c.

References ap, bp, and mpn_cmp().

Referenced by mpz_abs_sub(), and mpz_cmpabs().

◆ mpn_com()

void mpn_com ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n 
)

Definition at line 742 of file mini-gmp.c.

References n, rp, and up.

Referenced by mpn_neg().

◆ mpn_common_scan()

static mp_bitcnt_t mpn_common_scan ( mp_limb_t  limb,
mp_size_t  i,
mp_srcptr  up,
mp_size_t  un,
mp_limb_t  ux 
)
static

Definition at line 702 of file mini-gmp.c.

References assert(), cnt, gmp_ctz, GMP_LIMB_BITS, GMP_LIMB_MAX, i, and up.

Referenced by mpn_scan0(), mpn_scan1(), mpz_make_odd(), mpz_scan0(), and mpz_scan1().

◆ mpn_copyd()

void mpn_copyd ( mp_ptr  d,
mp_srcptr  s,
mp_size_t  n 
)

Definition at line 382 of file mini-gmp.c.

References d, n, and s.

Referenced by mpn_sqrtrem(), and mpz_mul_2exp().

◆ mpn_copyi()

void mpn_copyi ( mp_ptr  d,
mp_srcptr  s,
mp_size_t  n 
)

Definition at line 374 of file mini-gmp.c.

References d, i, n, and s.

Referenced by mpz_div_q_2exp(), mpz_div_r_2exp(), mpz_get_str(), mpz_set(), and mpz_sizeinbase().

◆ mpn_div_qr()

static void mpn_div_qr ( mp_ptr  qp,
mp_ptr  np,
mp_size_t  nn,
mp_srcptr  dp,
mp_size_t  dn 
)
static

◆ mpn_div_qr_1_invert()

static void mpn_div_qr_1_invert ( struct gmp_div_inverse inv,
mp_limb_t  d 
)
static

◆ mpn_div_qr_1_preinv()

◆ mpn_div_qr_2_invert()

static void mpn_div_qr_2_invert ( struct gmp_div_inverse inv,
mp_limb_t  d1,
mp_limb_t  d0 
)
static

◆ mpn_div_qr_2_preinv()

static void mpn_div_qr_2_preinv ( mp_ptr  qp,
mp_ptr  np,
mp_size_t  nn,
const struct gmp_div_inverse inv 
)
static

◆ mpn_div_qr_invert()

◆ mpn_div_qr_pi1()

static void mpn_div_qr_pi1 ( mp_ptr  qp,
mp_ptr  np,
mp_size_t  nn,
mp_limb_t  n1,
mp_srcptr  dp,
mp_size_t  dn,
mp_limb_t  dinv 
)
static

Definition at line 1031 of file mini-gmp.c.

References assert(), cy, d0, d1, dinv, dn, dp, GMP_LIMB_HIGHBIT, GMP_LIMB_MAX, gmp_udiv_qr_3by2, i, mpn_add_n(), mpn_submul_1(), nn, np, and q.

Referenced by mpn_div_qr_preinv().

◆ mpn_div_qr_preinv()

◆ mpn_gcd_11()

static mp_limb_t mpn_gcd_11 ( mp_limb_t  u,
mp_limb_t  v 
)
static

Definition at line 2624 of file mini-gmp.c.

References assert(), gmp_ctz, MP_LIMB_T_SWAP, shift, u, and v.

Referenced by mpz_gcd().

◆ mpn_get_base_info()

static void mpn_get_base_info ( struct mpn_base_info info,
mp_limb_t  b 
)
static

Definition at line 1176 of file mini-gmp.c.

References b, exp(), GMP_LIMB_MAX, info, m, and p.

Referenced by mpn_get_str(), mpn_set_str(), mpz_get_str(), and mpz_set_str().

◆ mpn_get_str()

size_t mpn_get_str ( unsigned char *  sp,
int  base,
mp_ptr  up,
mp_size_t  un 
)

◆ mpn_get_str_bits()

static size_t mpn_get_str_bits ( unsigned char *  sp,
unsigned  bits,
mp_srcptr  up,
mp_size_t  un 
)
static

Definition at line 1201 of file mini-gmp.c.

References bits, digit, GMP_LIMB_BITS, i, j, mask, mpn_limb_size_in_base_2(), shift, sp, and up.

Referenced by mpn_get_str(), and mpz_get_str().

◆ mpn_get_str_other()

static size_t mpn_get_str_other ( unsigned char *  sp,
int  base,
const struct mpn_base_info info,
mp_ptr  up,
mp_size_t  un 
)
static

Definition at line 1253 of file mini-gmp.c.

References base, i, info, mpn_div_qr_1_invert(), mpn_div_qr_1_preinv(), mpn_limb_get_str(), sp, t, up, and w.

Referenced by mpn_get_str(), and mpz_get_str().

◆ mpn_invert_3by2()

mp_limb_t mpn_invert_3by2 ( mp_limb_t  u1,
mp_limb_t  u0 
)

Definition at line 771 of file mini-gmp.c.

References GMP_LIMB_BITS, GMP_LIMB_MAX, GMP_LLIMB_MASK, gmp_umul_ppmm, m, p, and r.

Referenced by mpn_div_qr_2_invert(), and mpn_div_qr_invert().

◆ mpn_limb_get_str()

static size_t mpn_limb_get_str ( unsigned char *  sp,
mp_limb_t  w,
const struct gmp_div_inverse binv 
)
static

◆ mpn_limb_size_in_base_2()

static mp_bitcnt_t mpn_limb_size_in_base_2 ( mp_limb_t  u)
static

Definition at line 1191 of file mini-gmp.c.

References assert(), gmp_clz, GMP_LIMB_BITS, shift, and u.

Referenced by mpn_get_str_bits(), and mpz_sizeinbase().

◆ mpn_lshift()

mp_limb_t mpn_lshift ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n,
unsigned int  cnt 
)

◆ mpn_mul()

mp_limb_t mpn_mul ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  un,
mp_srcptr  vp,
mp_size_t  vn 
)

Definition at line 608 of file mini-gmp.c.

References assert(), GMP_MPN_OVERLAP_P, mpn_addmul_1(), mpn_mul_1(), rp, and up.

Referenced by mpn_mul_n(), mpn_sqr(), and mpz_mul().

◆ mpn_mul_1()

mp_limb_t mpn_mul_1 ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n,
mp_limb_t  vl 
)

Definition at line 533 of file mini-gmp.c.

References assert(), gmp_umul_ppmm, n, rp, and up.

Referenced by mpn_mul(), and mpn_set_str_other().

◆ mpn_mul_n()

void mpn_mul_n ( mp_ptr  rp,
mp_srcptr  ap,
mp_srcptr  bp,
mp_size_t  n 
)

Definition at line 633 of file mini-gmp.c.

References ap, bp, mpn_mul(), n, and rp.

◆ mpn_neg()

mp_limb_t mpn_neg ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n 
)

Definition at line 749 of file mini-gmp.c.

References mpn_com(), n, rp, and up.

Referenced by mpz_div_r_2exp().

◆ mpn_normalized_size()

static mp_size_t mpn_normalized_size ( mp_srcptr  xp,
mp_size_t  n 
)
static

◆ mpn_perfect_square_p()

int mpn_perfect_square_p ( mp_srcptr  p,
mp_size_t  n 
)

Definition at line 3257 of file mini-gmp.c.

References assert(), mpz_roinit_normal_n(), mpz_root(), n, NULL, p, and t.

◆ mpn_popcount()

mp_bitcnt_t mpn_popcount ( mp_srcptr  p,
mp_size_t  n 
)

Definition at line 4001 of file mini-gmp.c.

References c, gmp_popcount_limb(), i, n, and p.

Referenced by mpz_popcount().

◆ mpn_rshift()

mp_limb_t mpn_rshift ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n,
unsigned int  cnt 
)

Definition at line 675 of file mini-gmp.c.

References assert(), cnt, GMP_LIMB_BITS, n, rp, and up.

Referenced by mpn_div_qr_preinv(), and mpz_div_q_2exp().

◆ mpn_scan0()

mp_bitcnt_t mpn_scan0 ( mp_srcptr  ptr,
mp_bitcnt_t  bit 
)

Definition at line 732 of file mini-gmp.c.

References GMP_LIMB_BITS, GMP_LIMB_MAX, i, mpn_common_scan(), and ptr.

◆ mpn_scan1()

mp_bitcnt_t mpn_scan1 ( mp_srcptr  ptr,
mp_bitcnt_t  bit 
)

Definition at line 722 of file mini-gmp.c.

References GMP_LIMB_BITS, GMP_LIMB_MAX, i, mpn_common_scan(), and ptr.

◆ mpn_set_str()

mp_size_t mpn_set_str ( mp_ptr  rp,
const unsigned char *  sp,
size_t  sn,
int  base 
)

◆ mpn_set_str_bits()

static mp_size_t mpn_set_str_bits ( mp_ptr  rp,
const unsigned char *  sp,
size_t  sn,
unsigned  bits 
)
static

Definition at line 1317 of file mini-gmp.c.

References bits, GMP_LIMB_BITS, j, mpn_normalized_size(), rp, shift, and sp.

Referenced by mpn_set_str(), and mpz_set_str().

◆ mpn_set_str_other()

static mp_size_t mpn_set_str_other ( mp_ptr  rp,
const unsigned char *  sp,
size_t  sn,
mp_limb_t  b,
const struct mpn_base_info info 
)
static

Definition at line 1350 of file mini-gmp.c.

References assert(), b, cy, info, j, k, mpn_add_1(), mpn_mul_1(), rp, sp, w, and while().

Referenced by mpn_set_str(), and mpz_set_str().

◆ mpn_sqr()

void mpn_sqr ( mp_ptr  rp,
mp_srcptr  ap,
mp_size_t  n 
)

Definition at line 639 of file mini-gmp.c.

References ap, mpn_mul(), n, and rp.

◆ mpn_sqrtrem()

mp_size_t mpn_sqrtrem ( mp_ptr  sp,
mp_ptr  rp,
mp_srcptr  p,
mp_size_t  n 
)

Definition at line 3267 of file mini-gmp.c.

References assert(), mpn_copyd(), mpz_clear(), mpz_init(), mpz_roinit_normal_n(), mpz_rootrem(), n, p, r, res, rp, s, sp, and u.

◆ mpn_sub()

mp_limb_t mpn_sub ( mp_ptr  rp,
mp_srcptr  ap,
mp_size_t  an,
mp_srcptr  bp,
mp_size_t  bn 
)

Definition at line 520 of file mini-gmp.c.

References ap, assert(), bp, cy, mpn_sub_1(), mpn_sub_n(), and rp.

Referenced by mpz_abs_sub(), and mpz_powm().

◆ mpn_sub_1()

mp_limb_t mpn_sub_1 ( mp_ptr  rp,
mp_srcptr  ap,
mp_size_t  n,
mp_limb_t  b 
)

Definition at line 481 of file mini-gmp.c.

References a, ap, assert(), b, cy, i, n, and rp.

Referenced by mpn_sub(), and mpz_abs_sub_bit().

◆ mpn_sub_n()

mp_limb_t mpn_sub_n ( mp_ptr  rp,
mp_srcptr  ap,
mp_srcptr  bp,
mp_size_t  n 
)

Definition at line 502 of file mini-gmp.c.

References a, ap, b, bp, cy, i, n, and rp.

Referenced by mpn_sub().

◆ mpn_submul_1()

mp_limb_t mpn_submul_1 ( mp_ptr  rp,
mp_srcptr  up,
mp_size_t  n,
mp_limb_t  vl 
)

Definition at line 582 of file mini-gmp.c.

References assert(), gmp_umul_ppmm, n, gen-ragel-artifacts::rl, rp, and up.

Referenced by mpn_div_qr_pi1().

◆ mpn_zero()

void mpn_zero ( mp_ptr  rp,
mp_size_t  n 
)

Definition at line 423 of file mini-gmp.c.

References n, and rp.

Referenced by mpz_mul_2exp().

◆ mpn_zero_p()

int mpn_zero_p ( mp_srcptr  rp,
mp_size_t  n 
)

Definition at line 417 of file mini-gmp.c.

References mpn_normalized_size(), n, and rp.

Referenced by mpz_div_q_2exp(), mpz_scan0(), and mpz_scan1().

◆ mpz_2fac_ui()

void mpz_2fac_ui ( mpz_t  x,
unsigned long  n 
)

Definition at line 3301 of file mini-gmp.c.

References mpz_mfac_uiui(), n, and cordic::x.

◆ mpz_abs()

void mpz_abs ( mpz_t  r,
const mpz_t  u 
)

Definition at line 1889 of file mini-gmp.c.

References GMP_ABS, mpz_set(), r, and u.

Referenced by mpz_gcd(), mpz_gcdext(), mpz_lcm(), mpz_lcm_ui(), mpz_powm(), and mpz_probab_prime_p().

◆ mpz_abs_add()

static mp_size_t mpz_abs_add ( mpz_t  r,
const mpz_t  a,
const mpz_t  b 
)
static

Definition at line 1938 of file mini-gmp.c.

References a, b, cy, GMP_ABS, MP_SIZE_T_SWAP, mpn_add(), MPZ_REALLOC, MPZ_SRCPTR_SWAP, r, and rp.

Referenced by mpz_add(), and mpz_sub().

◆ mpz_abs_add_bit()

static void mpz_abs_add_bit ( mpz_t  d,
mp_bitcnt_t  bit_index 
)
static

Definition at line 3663 of file mini-gmp.c.

References cy, d, dn, dp, GMP_ABS, GMP_LIMB_BITS, i, mpn_add_1(), and MPZ_REALLOC.

Referenced by mpz_clrbit(), mpz_combit(), and mpz_setbit().

◆ mpz_abs_sub()

static mp_size_t mpz_abs_sub ( mpz_t  r,
const mpz_t  a,
const mpz_t  b 
)
static

Definition at line 1960 of file mini-gmp.c.

References a, b, cmp(), GMP_ABS, gmp_assert_nocarry, mpn_cmp4(), mpn_normalized_size(), mpn_sub(), MPZ_REALLOC, r, and rp.

Referenced by mpz_add(), and mpz_sub().

◆ mpz_abs_sub_bit()

static void mpz_abs_sub_bit ( mpz_t  d,
mp_bitcnt_t  bit_index 
)
static

◆ mpz_add()

void mpz_add ( mpz_t  r,
const mpz_t  a,
const mpz_t  b 
)

◆ mpz_add_ui()

void mpz_add_ui ( mpz_t  r,
const mpz_t  a,
unsigned long  b 
)

Definition at line 1915 of file mini-gmp.c.

References a, b, mpn_base_info::bb, mpz_add(), mpz_clear(), mpz_init_set_ui(), and r.

Referenced by mpz_com(), mpz_div_q_2exp(), mpz_div_qr(), and mpz_ui_sub().

◆ mpz_addmul()

void mpz_addmul ( mpz_t  r,
const mpz_t  u,
const mpz_t  v 
)

Definition at line 2127 of file mini-gmp.c.

References mpz_add(), mpz_clear(), mpz_init(), mpz_mul(), r, t, u, and v.

◆ mpz_addmul_ui()

void mpz_addmul_ui ( mpz_t  r,
const mpz_t  u,
unsigned long int  v 
)

Definition at line 2107 of file mini-gmp.c.

References mpz_add(), mpz_clear(), mpz_init_set_ui(), mpz_mul(), r, t, u, and v.

◆ mpz_and()

void mpz_and ( mpz_t  r,
const mpz_t  u,
const mpz_t  v 
)

◆ mpz_bin_uiui()

void mpz_bin_uiui ( mpz_t  r,
unsigned long  n,
unsigned long  k 
)

Definition at line 3313 of file mini-gmp.c.

References k, mpz_clear(), mpz_divexact(), mpz_fac_ui(), mpz_init(), mpz_mul_ui(), mpz_set_ui(), n, r, and t.

◆ mpz_cdiv_q()

void mpz_cdiv_q ( mpz_t  q,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2282 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr(), n, NULL, and q.

◆ mpz_cdiv_q_2exp()

void mpz_cdiv_q_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  cnt 
)

Definition at line 2448 of file mini-gmp.c.

References cnt, GMP_DIV_CEIL, mpz_div_q_2exp(), r, and u.

◆ mpz_cdiv_q_ui()

unsigned long mpz_cdiv_q_ui ( mpz_t  q,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2552 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr_ui(), n, NULL, and q.

◆ mpz_cdiv_qr()

void mpz_cdiv_qr ( mpz_t  q,
mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2264 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr(), n, q, and r.

◆ mpz_cdiv_qr_ui()

unsigned long mpz_cdiv_qr_ui ( mpz_t  q,
mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2534 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr_ui(), n, q, and r.

◆ mpz_cdiv_r()

void mpz_cdiv_r ( mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2300 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr(), n, NULL, and r.

◆ mpz_cdiv_r_2exp()

void mpz_cdiv_r_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  cnt 
)

Definition at line 2466 of file mini-gmp.c.

References cnt, GMP_DIV_CEIL, mpz_div_r_2exp(), r, and u.

◆ mpz_cdiv_r_ui()

unsigned long mpz_cdiv_r_ui ( mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2570 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr_ui(), n, NULL, and r.

◆ mpz_cdiv_ui()

unsigned long mpz_cdiv_ui ( const mpz_t  n,
unsigned long  d 
)

Definition at line 2586 of file mini-gmp.c.

References d, GMP_DIV_CEIL, mpz_div_qr_ui(), n, and NULL.

◆ mpz_clear()

◆ mpz_clrbit()

void mpz_clrbit ( mpz_t  d,
mp_bitcnt_t  bit_index 
)

Definition at line 3737 of file mini-gmp.c.

References d, mpz_abs_add_bit(), mpz_abs_sub_bit(), and mpz_tstbit().

◆ mpz_cmp()

int mpz_cmp ( const mpz_t  a,
const mpz_t  b 
)

Definition at line 1854 of file mini-gmp.c.

References a, b, and mpn_cmp().

Referenced by gmp_millerrabin(), mpz_congruent_p(), mpz_gcd(), mpz_gcdext(), and mpz_probab_prime_p().

◆ mpz_cmp_d()

int mpz_cmp_d ( const mpz_t  x,
double  d 
)

Definition at line 1803 of file mini-gmp.c.

References d, mpz_cmpabs_d(), and cordic::x.

◆ mpz_cmp_si()

int mpz_cmp_si ( const mpz_t  u,
long  v 
)

Definition at line 1830 of file mini-gmp.c.

References GMP_NEG_CAST, mpz_cmp_ui(), mpz_cmpabs_ui(), u, and v.

◆ mpz_cmp_ui()

int mpz_cmp_ui ( const mpz_t  u,
unsigned long  v 
)

Definition at line 1843 of file mini-gmp.c.

References mpz_cmpabs_ui(), u, and v.

Referenced by gmp_lucas_mod(), gmp_millerrabin(), mpz_cmp_si(), mpz_fits_slong_p(), and mpz_invert().

◆ mpz_cmpabs()

int mpz_cmpabs ( const mpz_t  u,
const mpz_t  v 
)

Definition at line 1882 of file mini-gmp.c.

References GMP_ABS, mpn_cmp4(), u, and v.

Referenced by mpz_gcdext(), and mpz_rootrem().

◆ mpz_cmpabs_d()

int mpz_cmpabs_d ( const mpz_t  x,
double  d 
)

Definition at line 1762 of file mini-gmp.c.

References B, d, f, GMP_ABS, GMP_LIMB_HIGHBIT, i, and cordic::x.

Referenced by mpz_cmp_d().

◆ mpz_cmpabs_ui()

int mpz_cmpabs_ui ( const mpz_t  u,
unsigned long  v 
)

◆ mpz_com()

void mpz_com ( mpz_t  r,
const mpz_t  u 
)

Definition at line 3758 of file mini-gmp.c.

References mpz_add_ui(), mpz_neg(), r, and u.

◆ mpz_combit()

void mpz_combit ( mpz_t  d,
mp_bitcnt_t  bit_index 
)

Definition at line 3749 of file mini-gmp.c.

References d, mpz_abs_add_bit(), mpz_abs_sub_bit(), and mpz_tstbit().

◆ mpz_congruent_p()

int mpz_congruent_p ( const mpz_t  a,
const mpz_t  b,
const mpz_t  m 
)

Definition at line 2496 of file mini-gmp.c.

References a, b, m, mpz_clear(), mpz_cmp(), mpz_divisible_p(), mpz_init(), mpz_sgn(), mpz_sub(), res, and t.

◆ mpz_div_q_2exp()

static void mpz_div_q_2exp ( mpz_t  q,
const mpz_t  u,
mp_bitcnt_t  bit_index,
enum mpz_div_round_mode  mode 
)
static

◆ mpz_div_qr()

◆ mpz_div_qr_ui()

◆ mpz_div_r_2exp()

◆ mpz_divexact()

void mpz_divexact ( mpz_t  q,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2484 of file mini-gmp.c.

References d, gmp_assert_nocarry, GMP_DIV_TRUNC, mpz_div_qr(), n, NULL, and q.

Referenced by mpz_bin_uiui(), mpz_gcdext(), and mpz_lcm().

◆ mpz_divexact_ui()

void mpz_divexact_ui ( mpz_t  q,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2610 of file mini-gmp.c.

References d, gmp_assert_nocarry, GMP_DIV_TRUNC, mpz_div_qr_ui(), n, NULL, and q.

◆ mpz_divisible_p()

int mpz_divisible_p ( const mpz_t  n,
const mpz_t  d 
)

Definition at line 2490 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr(), n, and NULL.

Referenced by mpz_congruent_p().

◆ mpz_divisible_ui_p()

int mpz_divisible_ui_p ( const mpz_t  n,
unsigned long  d 
)

Definition at line 2616 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr_ui(), n, and NULL.

◆ mpz_export()

void* mpz_export ( void r,
size_t countp,
int  order,
size_t  size,
int  endian,
size_t  nails,
const mpz_t  u 
)

Definition at line 4471 of file mini-gmp.c.

References assert(), bytes, CHAR_BIT, count, GMP_ABS, gmp_detect_endian(), gmp_die(), GMP_LIMB_BITS, gmp_xalloc, i, j, k, p, r, size, and u.

◆ mpz_fac_ui()

void mpz_fac_ui ( mpz_t  x,
unsigned long  n 
)

Definition at line 3307 of file mini-gmp.c.

References mpz_mfac_uiui(), n, and cordic::x.

Referenced by mpz_bin_uiui().

◆ mpz_fdiv_q()

void mpz_fdiv_q ( mpz_t  q,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2288 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr(), n, NULL, and q.

◆ mpz_fdiv_q_2exp()

void mpz_fdiv_q_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  cnt 
)

Definition at line 2454 of file mini-gmp.c.

References cnt, GMP_DIV_FLOOR, mpz_div_q_2exp(), r, and u.

◆ mpz_fdiv_q_ui()

unsigned long mpz_fdiv_q_ui ( mpz_t  q,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2558 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr_ui(), n, NULL, and q.

◆ mpz_fdiv_qr()

void mpz_fdiv_qr ( mpz_t  q,
mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2270 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr(), n, q, and r.

◆ mpz_fdiv_qr_ui()

unsigned long mpz_fdiv_qr_ui ( mpz_t  q,
mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2540 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr_ui(), n, q, and r.

◆ mpz_fdiv_r()

void mpz_fdiv_r ( mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2306 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr(), n, NULL, and r.

◆ mpz_fdiv_r_2exp()

void mpz_fdiv_r_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  cnt 
)

Definition at line 2472 of file mini-gmp.c.

References cnt, GMP_DIV_FLOOR, mpz_div_r_2exp(), r, and u.

◆ mpz_fdiv_r_ui()

unsigned long mpz_fdiv_r_ui ( mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2575 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr_ui(), n, NULL, and r.

◆ mpz_fdiv_ui()

unsigned long mpz_fdiv_ui ( const mpz_t  n,
unsigned long  d 
)

Definition at line 2592 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr_ui(), n, and NULL.

◆ mpz_fits_slong_p()

int mpz_fits_slong_p ( const mpz_t  u)

Definition at line 1542 of file mini-gmp.c.

References GMP_NEG_CAST, LONG_MAX, LONG_MIN, mpz_cmp_ui(), mpz_cmpabs_ui(), and u.

◆ mpz_fits_ulong_p()

int mpz_fits_ulong_p ( const mpz_t  u)

Definition at line 1561 of file mini-gmp.c.

References mpn_absfits_ulong_p(), and u.

◆ mpz_gcd()

◆ mpz_gcd_ui()

unsigned long mpz_gcd_ui ( mpz_t  g,
const mpz_t  u,
unsigned long  v 
)

Definition at line 2667 of file mini-gmp.c.

References g, mpz_clear(), mpz_gcd(), mpz_get_ui(), mpz_init_set_ui(), mpz_swap(), t, u, and v.

Referenced by mpz_lcm_ui(), and mpz_probab_prime_p().

◆ mpz_gcdext()

◆ mpz_get_d()

double mpz_get_d ( const mpz_t  u)

◆ mpz_get_si()

long int mpz_get_si ( const mpz_t  u)

Definition at line 1569 of file mini-gmp.c.

References c, LONG_MAX, LONG_MIN, mpz_get_ui(), r, and u.

◆ mpz_get_str()

char* mpz_get_str ( char *  sp,
int  base,
const mpz_t  u 
)

◆ mpz_get_ui()

unsigned long int mpz_get_ui ( const mpz_t  u)

Definition at line 1582 of file mini-gmp.c.

References GMP_ABS, GMP_LIMB_BITS, GMP_MIN, GMP_ULONG_BITS, n, r, and u.

Referenced by mpz_cmpabs_ui(), mpz_div_qr_ui(), mpz_gcd_ui(), and mpz_get_si().

◆ mpz_getlimbn()

mp_limb_t mpz_getlimbn ( const mpz_t  u,
mp_size_t  n 
)

Definition at line 1605 of file mini-gmp.c.

References GMP_ABS, n, and u.

◆ mpz_hamdist()

mp_bitcnt_t mpz_hamdist ( const mpz_t  u,
const mpz_t  v 
)

Definition at line 4026 of file mini-gmp.c.

References assert(), c, gmp_popcount_limb(), i, MPN_SRCPTR_SWAP, u, up, and v.

◆ mpz_import()

void mpz_import ( mpz_t  r,
size_t  count,
int  order,
size_t  size,
int  endian,
size_t  nails,
const void src 
)

◆ mpz_init()

◆ mpz_init2()

void mpz_init2 ( mpz_t  r,
mp_bitcnt_t  bits 
)

Definition at line 1422 of file mini-gmp.c.

References GMP_LIMB_BITS, gmp_xalloc_limbs(), and r.

Referenced by mpz_div_qr(), and mpz_mul().

◆ mpz_init_set()

void mpz_init_set ( mpz_t  r,
const mpz_t  x 
)

Definition at line 1535 of file mini-gmp.c.

References mpz_init(), mpz_set(), r, and cordic::x.

Referenced by mpz_div_qr().

◆ mpz_init_set_d()

void mpz_init_set_d ( mpz_t  r,
double  x 
)

Definition at line 1717 of file mini-gmp.c.

References mpz_init(), mpz_set_d(), r, and cordic::x.

◆ mpz_init_set_si()

void mpz_init_set_si ( mpz_t  r,
signed long int  x 
)

Definition at line 1521 of file mini-gmp.c.

References mpz_init(), mpz_set_si(), r, and cordic::x.

◆ mpz_init_set_str()

int mpz_init_set_str ( mpz_t  r,
const char *  sp,
int  base 
)

Definition at line 4371 of file mini-gmp.c.

References base, mpz_init(), mpz_set_str(), r, and sp.

◆ mpz_init_set_ui()

◆ mpz_invert()

int mpz_invert ( mpz_t  r,
const mpz_t  u,
const mpz_t  m 
)

Definition at line 2979 of file mini-gmp.c.

References g, m, mpz_add(), mpz_clear(), mpz_cmp_ui(), mpz_cmpabs_ui(), mpz_gcdext(), mpz_init(), mpz_sub(), mpz_swap(), NULL, r, and u.

Referenced by mpz_powm().

◆ mpz_ior()

void mpz_ior ( mpz_t  r,
const mpz_t  u,
const mpz_t  v 
)

◆ mpz_lcm()

void mpz_lcm ( mpz_t  r,
const mpz_t  u,
const mpz_t  v 
)

Definition at line 2943 of file mini-gmp.c.

References g, mpz_abs(), mpz_clear(), mpz_divexact(), mpz_gcd(), mpz_init(), mpz_mul(), r, u, and v.

◆ mpz_lcm_ui()

void mpz_lcm_ui ( mpz_t  r,
const mpz_t  u,
unsigned long  v 
)

Definition at line 2964 of file mini-gmp.c.

References mpz_abs(), mpz_gcd_ui(), mpz_mul_ui(), NULL, r, u, and v.

◆ mpz_limbs_finish()

void mpz_limbs_finish ( mpz_t  x,
mp_size_t  xs 
)

Definition at line 1639 of file mini-gmp.c.

References GMP_ABS, mpn_normalized_size(), and cordic::x.

Referenced by mpz_roinit_n().

◆ mpz_limbs_modify()

mp_ptr mpz_limbs_modify ( mpz_t  x,
mp_size_t  n 
)

Definition at line 1626 of file mini-gmp.c.

References assert(), MPZ_REALLOC, n, and cordic::x.

Referenced by mpz_limbs_write().

◆ mpz_limbs_read()

mp_srcptr mpz_limbs_read ( mpz_srcptr  x)

Definition at line 1620 of file mini-gmp.c.

References cordic::x.

◆ mpz_limbs_write()

mp_ptr mpz_limbs_write ( mpz_t  x,
mp_size_t  n 
)

Definition at line 1633 of file mini-gmp.c.

References mpz_limbs_modify(), n, and cordic::x.

◆ mpz_make_odd()

static mp_bitcnt_t mpz_make_odd ( mpz_t  r)
static

Definition at line 2684 of file mini-gmp.c.

References assert(), mpn_common_scan(), mpz_tdiv_q_2exp(), r, and shift.

Referenced by binvert(), mpz_gcd(), and mpz_gcdext().

◆ mpz_mfac_uiui()

void mpz_mfac_uiui ( mpz_t  x,
unsigned long  n,
unsigned long  m 
)

Definition at line 3292 of file mini-gmp.c.

References m, mpz_mul_ui(), mpz_set_ui(), n, and cordic::x.

Referenced by mpz_2fac_ui(), and mpz_fac_ui().

◆ mpz_mod()

void mpz_mod ( mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2318 of file mini-gmp.c.

References d, GMP_DIV_CEIL, GMP_DIV_FLOOR, mpz_div_qr(), n, NULL, and r.

Referenced by gmp_lucas_step_k_2k().

◆ mpz_mod_ui()

unsigned long mpz_mod_ui ( mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2604 of file mini-gmp.c.

References d, GMP_DIV_FLOOR, mpz_div_qr_ui(), n, NULL, and r.

◆ mpz_mul()

◆ mpz_mul_2exp()

void mpz_mul_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  bits 
)

Definition at line 2073 of file mini-gmp.c.

References cy, GMP_ABS, GMP_LIMB_BITS, mpn_copyd(), mpn_lshift(), mpn_zero(), MPZ_REALLOC, r, rp, shift, and u.

Referenced by mpz_gcd(), and mpz_gcdext().

◆ mpz_mul_si()

void mpz_mul_si ( mpz_t  r,
const mpz_t  u,
long int  v 
)

Definition at line 2013 of file mini-gmp.c.

References GMP_NEG_CAST, mpz_mul_ui(), mpz_neg(), r, u, and v.

Referenced by gmp_lucas_mod().

◆ mpz_mul_ui()

void mpz_mul_ui ( mpz_t  r,
const mpz_t  u,
unsigned long int  v 
)

Definition at line 2025 of file mini-gmp.c.

References mpz_clear(), mpz_init_set_ui(), mpz_mul(), r, u, v, and vv.

Referenced by mpz_bin_uiui(), mpz_lcm_ui(), mpz_mfac_uiui(), mpz_mul_si(), and mpz_rootrem().

◆ mpz_neg()

void mpz_neg ( mpz_t  r,
const mpz_t  u 
)

Definition at line 1896 of file mini-gmp.c.

References mpz_set(), r, and u.

Referenced by mpz_com(), mpz_div_q_2exp(), mpz_gcdext(), mpz_mul_si(), mpz_rootrem(), mpz_set_si(), mpz_sub_ui(), and mpz_ui_sub().

◆ mpz_out_str()

size_t mpz_out_str ( FILE stream,
int  base,
const mpz_t  x 
)

Definition at line 4378 of file mini-gmp.c.

References base, fwrite(), gmp_free, len, mpz_get_str(), NULL, str, strlen(), and cordic::x.

Referenced by __gmpq_out_str(), gen_consts(), header(), main(), mpfr_fdump(), print(), and table().

◆ mpz_perfect_square_p()

int mpz_perfect_square_p ( const mpz_t  u)

Definition at line 3248 of file mini-gmp.c.

References mpz_root(), NULL, and u.

◆ mpz_popcount()

mp_bitcnt_t mpz_popcount ( const mpz_t  u)

Definition at line 4013 of file mini-gmp.c.

References mpn_popcount(), and u.

◆ mpz_pow_ui()

void mpz_pow_ui ( mpz_t  r,
const mpz_t  b,
unsigned long  e 
)

Definition at line 3014 of file mini-gmp.c.

References b, e, GMP_ULONG_HIGHBIT, mpz_clear(), mpz_init_set_ui(), mpz_mul(), mpz_swap(), and r.

Referenced by mpz_rootrem(), and mpz_ui_pow_ui().

◆ mpz_powm()

◆ mpz_powm_ui()

void mpz_powm_ui ( mpz_t  r,
const mpz_t  b,
unsigned long  elimb,
const mpz_t  m 
)

Definition at line 3150 of file mini-gmp.c.

References b, e, m, mpz_clear(), mpz_init_set_ui(), mpz_powm(), and r.

Referenced by gmp_millerrabin().

◆ mpz_probab_prime_p()

◆ mpz_realloc()

static mp_ptr mpz_realloc ( mpz_t  r,
mp_size_t  size 
)
static

Definition at line 1442 of file mini-gmp.c.

References GMP_ABS, GMP_MAX, gmp_xalloc_limbs(), gmp_xrealloc_limbs(), r, and size.

Referenced by mpz_realloc2().

◆ mpz_realloc2()

void mpz_realloc2 ( mpz_t  x,
mp_bitcnt_t  n 
)

Definition at line 1614 of file mini-gmp.c.

References GMP_LIMB_BITS, mpz_realloc(), n, and cordic::x.

◆ mpz_roinit_n()

mpz_srcptr mpz_roinit_n ( mpz_t  x,
mp_srcptr  xp,
mp_size_t  xs 
)

Definition at line 1656 of file mini-gmp.c.

References mpz_limbs_finish(), mpz_roinit_normal_n(), cordic::x, and xp.

◆ mpz_roinit_normal_n()

static mpz_srcptr mpz_roinit_normal_n ( mpz_t  x,
mp_srcptr  xp,
mp_size_t  xs 
)
static

Definition at line 1647 of file mini-gmp.c.

References cordic::x, and xp.

Referenced by gmp_stronglucas(), mpn_perfect_square_p(), mpn_sqrtrem(), and mpz_roinit_n().

◆ mpz_root()

int mpz_root ( mpz_t  x,
const mpz_t  y,
unsigned long  z 
)

Definition at line 3221 of file mini-gmp.c.

References mpz_clear(), mpz_init(), mpz_rootrem(), r, res, cordic::x, y, and z.

Referenced by gmp_stronglucas(), mpn_perfect_square_p(), and mpz_perfect_square_p().

◆ mpz_rootrem()

◆ mpz_scan0()

mp_bitcnt_t mpz_scan0 ( const mpz_t  u,
mp_bitcnt_t  starting_bit 
)

Definition at line 4113 of file mini-gmp.c.

References GMP_ABS, GMP_LIMB_BITS, GMP_LIMB_MAX, i, mpn_common_scan(), mpn_zero_p(), u, and up.

◆ mpz_scan1()

mp_bitcnt_t mpz_scan1 ( const mpz_t  u,
mp_bitcnt_t  starting_bit 
)

Definition at line 4077 of file mini-gmp.c.

References GMP_ABS, GMP_LIMB_BITS, GMP_LIMB_MAX, i, mpn_common_scan(), mpn_zero_p(), u, and up.

Referenced by mpz_probab_prime_p().

◆ mpz_set()

void mpz_set ( mpz_t  r,
const mpz_t  x 
)

Definition at line 1504 of file mini-gmp.c.

References GMP_ABS, mpn_copyi(), MPZ_REALLOC, n, r, rp, and cordic::x.

Referenced by mpz_abs(), mpz_div_qr(), mpz_init_set(), mpz_ior(), mpz_neg(), mpz_rootrem(), and mpz_xor().

◆ mpz_set_d()

void mpz_set_d ( mpz_t  r,
double  x 
)

Definition at line 1666 of file mini-gmp.c.

References assert(), B, f, GMP_LIMB_HIGHBIT, i, MPZ_REALLOC, r, rp, sign, and cordic::x.

Referenced by mpz_init_set_d().

◆ mpz_set_si()

void mpz_set_si ( mpz_t  r,
signed long int  x 
)

◆ mpz_set_str()

int mpz_set_str ( mpz_t  r,
const char *  sp,
int  base 
)

◆ mpz_set_ui()

void mpz_set_ui ( mpz_t  r,
unsigned long int  x 
)

◆ mpz_setbit()

void mpz_setbit ( mpz_t  d,
mp_bitcnt_t  bit_index 
)

Definition at line 3725 of file mini-gmp.c.

References d, mpz_abs_add_bit(), mpz_abs_sub_bit(), and mpz_tstbit().

Referenced by mpz_gcdext(), and mpz_rootrem().

◆ mpz_sgn()

int mpz_sgn ( const mpz_t  u)

Definition at line 1824 of file mini-gmp.c.

References GMP_CMP, and u.

Referenced by mpz_congruent_p(), and mpz_gcdext().

◆ mpz_size()

size_t mpz_size ( const mpz_t  u)

Definition at line 1599 of file mini-gmp.c.

References GMP_ABS, and u.

◆ mpz_sizeinbase()

◆ mpz_sqrt()

void mpz_sqrt ( mpz_t  s,
const mpz_t  u 
)

Definition at line 3242 of file mini-gmp.c.

References mpz_rootrem(), NULL, s, and u.

◆ mpz_sqrtrem()

void mpz_sqrtrem ( mpz_t  s,
mpz_t  r,
const mpz_t  u 
)

Definition at line 3236 of file mini-gmp.c.

References mpz_rootrem(), r, s, and u.

◆ mpz_sub()

void mpz_sub ( mpz_t  r,
const mpz_t  a,
const mpz_t  b 
)

◆ mpz_sub_ui()

void mpz_sub_ui ( mpz_t  r,
const mpz_t  a,
unsigned long  b 
)

Definition at line 1924 of file mini-gmp.c.

References a, b, mpz_neg(), mpz_ui_sub(), and r.

Referenced by mpz_div_qr().

◆ mpz_submul()

void mpz_submul ( mpz_t  r,
const mpz_t  u,
const mpz_t  v 
)

Definition at line 2137 of file mini-gmp.c.

References mpz_clear(), mpz_init(), mpz_mul(), mpz_sub(), r, t, u, and v.

◆ mpz_submul_ui()

void mpz_submul_ui ( mpz_t  r,
const mpz_t  u,
unsigned long int  v 
)

Definition at line 2117 of file mini-gmp.c.

References mpz_clear(), mpz_init_set_ui(), mpz_mul(), mpz_sub(), r, t, u, and v.

Referenced by gmp_lucas_step_k_2k().

◆ mpz_swap()

◆ mpz_tdiv_q()

void mpz_tdiv_q ( mpz_t  q,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2294 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr(), n, NULL, and q.

Referenced by mpz_rootrem().

◆ mpz_tdiv_q_2exp()

void mpz_tdiv_q_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  cnt 
)

Definition at line 2460 of file mini-gmp.c.

References cnt, GMP_DIV_TRUNC, mpz_div_q_2exp(), r, and u.

Referenced by gmp_lucas_mod(), mpz_gcdext(), mpz_make_odd(), mpz_probab_prime_p(), and mpz_rootrem().

◆ mpz_tdiv_q_ui()

unsigned long mpz_tdiv_q_ui ( mpz_t  q,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2564 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr_ui(), n, NULL, and q.

Referenced by mpz_rootrem().

◆ mpz_tdiv_qr()

void mpz_tdiv_qr ( mpz_t  q,
mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2276 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr(), n, q, and r.

Referenced by mpz_gcdext().

◆ mpz_tdiv_qr_ui()

unsigned long mpz_tdiv_qr_ui ( mpz_t  q,
mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2546 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr_ui(), n, q, and r.

◆ mpz_tdiv_r()

void mpz_tdiv_r ( mpz_t  r,
const mpz_t  n,
const mpz_t  d 
)

Definition at line 2312 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr(), n, NULL, and r.

Referenced by gmp_lucas_mod(), gmp_lucas_step_k_2k(), and mpz_gcd().

◆ mpz_tdiv_r_2exp()

void mpz_tdiv_r_2exp ( mpz_t  r,
const mpz_t  u,
mp_bitcnt_t  cnt 
)

Definition at line 2478 of file mini-gmp.c.

References cnt, GMP_DIV_TRUNC, mpz_div_r_2exp(), r, and u.

◆ mpz_tdiv_r_ui()

unsigned long mpz_tdiv_r_ui ( mpz_t  r,
const mpz_t  n,
unsigned long  d 
)

Definition at line 2580 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr_ui(), n, NULL, and r.

◆ mpz_tdiv_ui()

unsigned long mpz_tdiv_ui ( const mpz_t  n,
unsigned long  d 
)

Definition at line 2598 of file mini-gmp.c.

References d, GMP_DIV_TRUNC, mpz_div_qr_ui(), n, and NULL.

Referenced by gmp_stronglucas(), and mpz_gcd().

◆ mpz_tstbit()

int mpz_tstbit ( const mpz_t  d,
mp_bitcnt_t  bit_index 
)

Definition at line 3630 of file mini-gmp.c.

References d, dn, GMP_ABS, GMP_LIMB_BITS, shift, and w.

Referenced by gmp_lucas_mod(), mpz_clrbit(), mpz_combit(), and mpz_setbit().

◆ mpz_ui_pow_ui()

void mpz_ui_pow_ui ( mpz_t  r,
unsigned long  blimb,
unsigned long  e 
)

Definition at line 3035 of file mini-gmp.c.

References b, e, mpz_clear(), mpz_init_set_ui(), mpz_pow_ui(), and r.

◆ mpz_ui_sub()

void mpz_ui_sub ( mpz_t  r,
unsigned long  a,
const mpz_t  b 
)

Definition at line 1931 of file mini-gmp.c.

References a, b, mpz_add_ui(), mpz_neg(), and r.

Referenced by mpz_sub_ui().

◆ mpz_xor()

void mpz_xor ( mpz_t  r,
const mpz_t  u,
const mpz_t  v 
)

Variable Documentation

◆ gmp_allocate_func

void*(* gmp_allocate_func) (size_t) ( size_t  ) = gmp_default_alloc
static

Definition at line 318 of file mini-gmp.c.

Referenced by mp_get_memory_functions(), mp_set_memory_functions(), and mpq_set_str().

◆ gmp_free_func

void(* gmp_free_func) (void *, size_t) ( void ,
size_t   
) = gmp_default_free
static

◆ gmp_reallocate_func

void*(* gmp_reallocate_func) (void *, size_t, size_t) ( void ,
size_t  ,
size_t   
) = gmp_default_realloc
static

Definition at line 319 of file mini-gmp.c.

Referenced by mp_get_memory_functions(), mp_set_memory_functions(), and mpq_get_str().

◆ mp_bits_per_limb

const int mp_bits_per_limb = (sizeof(mp_limb_t) * 8 )

Definition at line 274 of file mini-gmp.c.