QtBigInt
|
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mini-gmp.h"
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) 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(uIntMpz) * CHAR_BIT) |
#define | GMP_ULONG_HIGHBIT ((uIntMpz) 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_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 } |
Variables | |
const int | mp_bits_per_limb = GMP_LIMB_BITS |
#define GMP_ABS | ( | x | ) | ((x) >= 0 ? (x) : -(x)) |
Definition at line 66 of file mini-gmp.c.
#define gmp_add_ssaaaa | ( | sh, | |
sl, | |||
ah, | |||
al, | |||
bh, | |||
bl | |||
) |
Definition at line 98 of file mini-gmp.c.
#define gmp_assert_nocarry | ( | x | ) |
Definition at line 74 of file mini-gmp.c.
#define gmp_clz | ( | count, | |
x | |||
) |
Definition at line 79 of file mini-gmp.c.
#define GMP_CMP | ( | a, | |
b | |||
) | (((a) > (b)) - ((a) < (b))) |
Definition at line 72 of file mini-gmp.c.
#define gmp_ctz | ( | count, | |
x | |||
) |
Definition at line 91 of file mini-gmp.c.
#define gmp_free | ( | p | ) | ((*gmp_free_func) ((p), 0)) |
Definition at line 325 of file mini-gmp.c.
#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2)) |
Definition at line 60 of file mini-gmp.c.
#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT) |
Definition at line 55 of file mini-gmp.c.
#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1)) |
Definition at line 58 of file mini-gmp.c.
#define GMP_LIMB_MAX (~ (mp_limb_t) 0) |
Definition at line 57 of file mini-gmp.c.
#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1) |
Definition at line 61 of file mini-gmp.c.
#define GMP_MAX | ( | a, | |
b | |||
) | ((a) > (b) ? (a) : (b)) |
Definition at line 70 of file mini-gmp.c.
#define GMP_MIN | ( | a, | |
b | |||
) | ((a) < (b) ? (a) : (b)) |
Definition at line 69 of file mini-gmp.c.
#define GMP_NEG_CAST | ( | T, | |
x | |||
) | (-((T)((x) + 1) - 1)) |
Definition at line 67 of file mini-gmp.c.
#define GMP_PRIME_MASK 0xc96996dcUL |
Definition at line 3410 of file mini-gmp.c.
#define GMP_PRIME_PRODUCT (3UL*5UL*7UL*11UL*13UL*17UL*19UL*23UL*29UL) |
Definition at line 3406 of file mini-gmp.c.
#define gmp_sub_ddmmss | ( | sh, | |
sl, | |||
ah, | |||
al, | |||
bh, | |||
bl | |||
) |
Definition at line 106 of file mini-gmp.c.
#define gmp_udiv_qr_3by2 | ( | q, | |
r1, | |||
r0, | |||
n2, | |||
n1, | |||
n0, | |||
d1, | |||
d0, | |||
dinv | |||
) |
Definition at line 158 of file mini-gmp.c.
#define gmp_udiv_qrnnd_preinv | ( | q, | |
r, | |||
nh, | |||
nl, | |||
d, | |||
di | |||
) |
Definition at line 139 of file mini-gmp.c.
#define GMP_ULONG_BITS (sizeof(uIntMpz) * CHAR_BIT) |
Definition at line 63 of file mini-gmp.c.
#define GMP_ULONG_HIGHBIT ((uIntMpz) 1 << (GMP_ULONG_BITS - 1)) |
Definition at line 64 of file mini-gmp.c.
#define gmp_umul_ppmm | ( | w1, | |
w0, | |||
u, | |||
v | |||
) |
Definition at line 114 of file mini-gmp.c.
#define gmp_xalloc | ( | size | ) | ((*gmp_allocate_func)((size))) |
Definition at line 324 of file mini-gmp.c.
#define MP_BITCNT_T_SWAP | ( | x, | |
y | |||
) |
Definition at line 198 of file mini-gmp.c.
#define MP_LIMB_T_SWAP | ( | x, | |
y | |||
) |
Definition at line 186 of file mini-gmp.c.
#define MP_PTR_SWAP | ( | x, | |
y | |||
) |
Definition at line 204 of file mini-gmp.c.
#define MP_SIZE_T_SWAP | ( | x, | |
y | |||
) |
Definition at line 192 of file mini-gmp.c.
#define MP_SRCPTR_SWAP | ( | x, | |
y | |||
) |
Definition at line 210 of file mini-gmp.c.
#define MPN_PTR_SWAP | ( | xp, | |
xs, | |||
yp, | |||
ys | |||
) |
Definition at line 217 of file mini-gmp.c.
#define MPN_SRCPTR_SWAP | ( | xp, | |
xs, | |||
yp, | |||
ys | |||
) |
Definition at line 222 of file mini-gmp.c.
#define MPZ_PTR_SWAP | ( | x, | |
y | |||
) |
Definition at line 228 of file mini-gmp.c.
#define MPZ_REALLOC | ( | z, | |
n | |||
) |
Definition at line 1474 of file mini-gmp.c.
#define MPZ_SRCPTR_SWAP | ( | x, | |
y | |||
) |
Definition at line 234 of file mini-gmp.c.
enum mpz_div_round_mode |
Enumerator | |
---|---|
GMP_DIV_FLOOR | |
GMP_DIV_CEIL | |
GMP_DIV_TRUNC |
Definition at line 2171 of file mini-gmp.c.
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 293 of file mini-gmp.c.
void mp_set_memory_functions | ( | void *(*)(size_t) | alloc_func, |
void *(*)(void *, size_t, size_t) | realloc_func, | ||
void(*)(void *, size_t) | free_func | ||
) |
Definition at line 308 of file mini-gmp.c.
Definition at line 1312 of file mini-gmp.c.
Definition at line 739 of file mini-gmp.c.
Definition at line 578 of file mini-gmp.c.
mp_bitcnt_t mpn_popcount | ( | mp_srcptr | p, |
mp_size_t | n | ||
) |
Definition at line 643 of file mini-gmp.c.
mp_bitcnt_t mpn_scan0 | ( | mp_srcptr | ptr, |
mp_bitcnt_t | bit | ||
) |
Definition at line 700 of file mini-gmp.c.
mp_bitcnt_t mpn_scan1 | ( | mp_srcptr | ptr, |
mp_bitcnt_t | bit | ||
) |
Definition at line 690 of file mini-gmp.c.
Definition at line 1403 of file mini-gmp.c.
Definition at line 490 of file mini-gmp.c.
Definition at line 552 of file mini-gmp.c.
Definition at line 1844 of file mini-gmp.c.
Definition at line 1919 of file mini-gmp.c.
Definition at line 3634 of file mini-gmp.c.
Definition at line 2305 of file mini-gmp.c.
void mpz_cdiv_q_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | cnt | ||
) |
Definition at line 2471 of file mini-gmp.c.
Definition at line 2611 of file mini-gmp.c.
Definition at line 2287 of file mini-gmp.c.
Definition at line 2593 of file mini-gmp.c.
Definition at line 2323 of file mini-gmp.c.
void mpz_cdiv_r_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | cnt | ||
) |
Definition at line 2489 of file mini-gmp.c.
Definition at line 2629 of file mini-gmp.c.
Definition at line 2645 of file mini-gmp.c.
void mpz_clear | ( | mpz_t | r | ) |
void mpz_clrbit | ( | mpz_t | d, |
mp_bitcnt_t | bit_index | ||
) |
Definition at line 1814 of file mini-gmp.c.
int mpz_cmp_d | ( | const mpz_t | x, |
double | d | ||
) |
Definition at line 1801 of file mini-gmp.c.
int mpz_cmpabs_d | ( | const mpz_t | x, |
double | d | ||
) |
Definition at line 1828 of file mini-gmp.c.
void mpz_combit | ( | mpz_t | d, |
mp_bitcnt_t | bit_index | ||
) |
Definition at line 2675 of file mini-gmp.c.
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 4329 of file mini-gmp.c.
Definition at line 3350 of file mini-gmp.c.
Definition at line 2311 of file mini-gmp.c.
void mpz_fdiv_q_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | cnt | ||
) |
Definition at line 2477 of file mini-gmp.c.
Definition at line 2617 of file mini-gmp.c.
Definition at line 2293 of file mini-gmp.c.
Definition at line 2599 of file mini-gmp.c.
Definition at line 2329 of file mini-gmp.c.
void mpz_fdiv_r_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | cnt | ||
) |
Definition at line 2495 of file mini-gmp.c.
Definition at line 2634 of file mini-gmp.c.
Definition at line 2651 of file mini-gmp.c.
int mpz_fits_slong_p | ( | const mpz_t | u | ) |
Definition at line 1542 of file mini-gmp.c.
int mpz_fits_ulong_p | ( | const mpz_t | u | ) |
Definition at line 1555 of file mini-gmp.c.
Definition at line 2762 of file mini-gmp.c.
Definition at line 2726 of file mini-gmp.c.
Definition at line 2825 of file mini-gmp.c.
double mpz_get_d | ( | const mpz_t | u | ) |
Definition at line 1696 of file mini-gmp.c.
char * mpz_get_str | ( | char * | sp, |
int | base, | ||
const mpz_t | u | ||
) |
Definition at line 4062 of file mini-gmp.c.
Definition at line 1585 of file mini-gmp.c.
mp_bitcnt_t mpz_hamdist | ( | const mpz_t | u, |
const mpz_t | v | ||
) |
Definition at line 3890 of file mini-gmp.c.
void mpz_import | ( | mpz_t | r, |
size_t | count, | ||
int | order, | ||
size_t | size, | ||
int | endian, | ||
size_t | nails, | ||
const void * | src | ||
) |
Definition at line 4261 of file mini-gmp.c.
void mpz_init | ( | mpz_t | r | ) |
void mpz_init2 | ( | mpz_t | r, |
mp_bitcnt_t | bits | ||
) |
void mpz_init_set_d | ( | mpz_t | r, |
double | x | ||
) |
int mpz_init_set_str | ( | mpz_t | r, |
const char * | sp, | ||
int | base | ||
) |
Definition at line 1528 of file mini-gmp.c.
Definition at line 3043 of file mini-gmp.c.
mp_srcptr mpz_limbs_read | ( | mpz_srcptr | x | ) |
Definition at line 1600 of file mini-gmp.c.
Definition at line 2341 of file mini-gmp.c.
Definition at line 2663 of file mini-gmp.c.
Definition at line 2058 of file mini-gmp.c.
void mpz_mul_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | bits | ||
) |
Definition at line 2096 of file mini-gmp.c.
Definition at line 2033 of file mini-gmp.c.
Definition at line 1851 of file mini-gmp.c.
size_t mpz_out_str | ( | FILE * | stream, |
int | base, | ||
const mpz_t | x | ||
) |
int mpz_perfect_square_p | ( | const mpz_t | u | ) |
mp_bitcnt_t mpz_popcount | ( | const mpz_t | u | ) |
Definition at line 3078 of file mini-gmp.c.
Definition at line 3106 of file mini-gmp.c.
int mpz_probab_prime_p | ( | const mpz_t | n, |
int | reps | ||
) |
Definition at line 3413 of file mini-gmp.c.
void mpz_realloc2 | ( | mpz_t | x, |
mp_bitcnt_t | n | ||
) |
Definition at line 1594 of file mini-gmp.c.
mpz_srcptr mpz_roinit_n | ( | mpz_t | x, |
mp_srcptr | xp, | ||
mp_size_t | xs | ||
) |
Definition at line 1627 of file mini-gmp.c.
Definition at line 3279 of file mini-gmp.c.
Definition at line 3219 of file mini-gmp.c.
mp_bitcnt_t mpz_scan0 | ( | const mpz_t | u, |
mp_bitcnt_t | starting_bit | ||
) |
mp_bitcnt_t mpz_scan1 | ( | const mpz_t | u, |
mp_bitcnt_t | starting_bit | ||
) |
Definition at line 3941 of file mini-gmp.c.
Definition at line 1504 of file mini-gmp.c.
void mpz_set_d | ( | mpz_t | r, |
double | x | ||
) |
Definition at line 1480 of file mini-gmp.c.
int mpz_set_str | ( | mpz_t | r, |
const char * | sp, | ||
int | base | ||
) |
void mpz_setbit | ( | mpz_t | d, |
mp_bitcnt_t | bit_index | ||
) |
Definition at line 3594 of file mini-gmp.c.
int mpz_sgn | ( | const mpz_t | u | ) |
size_t mpz_size | ( | const mpz_t | u | ) |
size_t mpz_sizeinbase | ( | const mpz_t | u, |
int | base | ||
) |
Definition at line 4009 of file mini-gmp.c.
void mpz_tdiv_q_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | cnt | ||
) |
Definition at line 2605 of file mini-gmp.c.
void mpz_tdiv_r_2exp | ( | mpz_t | r, |
const mpz_t | u, | ||
mp_bitcnt_t | cnt | ||
) |
Definition at line 2501 of file mini-gmp.c.
Definition at line 2639 of file mini-gmp.c.
int mpz_tstbit | ( | const mpz_t | d, |
mp_bitcnt_t | bit_index | ||
) |
Definition at line 1937 of file mini-gmp.c.
const int mp_bits_per_limb = GMP_LIMB_BITS |
Definition at line 241 of file mini-gmp.c.