26 #ifndef MICROPY_INCLUDED_PY_MPZ_H 27 #define MICROPY_INCLUDED_PY_MPZ_H 48 #if defined(__x86_64__) || defined(_WIN64) 50 #define MPZ_DIG_SIZE (32) 53 #define MPZ_DIG_SIZE (16) 61 #elif MPZ_DIG_SIZE > 8 65 #elif MPZ_DIG_SIZE > 4 77 #define MPZ_LONG_1 1LL 79 #define MPZ_LONG_1 1i64 86 #define MPZ_NUM_DIG_FOR_INT ((sizeof(mp_int_t) * 8 + MPZ_DIG_SIZE - 1) / MPZ_DIG_SIZE) 87 #define MPZ_NUM_DIG_FOR_LL ((sizeof(long long) * 8 + MPZ_DIG_SIZE - 1) / MPZ_DIG_SIZE) 98 #define MPZ_CONST_INT(z, val) mpz_t z; mpz_dig_t z ## _digits[MPZ_NUM_DIG_FOR_INT]; mpz_init_fixed_from_int(&z, z_digits, MPZ_NUM_DIG_FOR_INT, val); 108 #if MICROPY_PY_BUILTINS_FLOAT 109 void mpz_set_from_float(
mpz_t *z, mp_float_t src);
114 static inline bool mpz_is_zero(
const mpz_t *z) {
return z->
len == 0; }
115 static inline bool mpz_is_neg(
const mpz_t *z) {
return z->
len != 0 && z->
neg != 0; }
138 #if MICROPY_PY_BUILTINS_FLOAT 139 mp_float_t mpz_as_float(
const mpz_t *z);
141 size_t mpz_as_str_inpl(
const mpz_t *z,
unsigned int base,
const char *prefix,
char base_char,
char comma,
char *str);
143 #endif // MICROPY_INCLUDED_PY_MPZ_H
void mpz_pow_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
void mpz_abs_inpl(mpz_t *dest, const mpz_t *z)
int mpz_cmp(const mpz_t *lhs, const mpz_t *rhs)
void mpz_shl_inpl(mpz_t *dest, const mpz_t *lhs, mp_uint_t rhs)
void mpz_neg_inpl(mpz_t *dest, const mpz_t *z)
bool mpz_as_int_checked(const mpz_t *z, mp_int_t *value)
void mpz_xor_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
void mpz_and_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
void mpz_init_from_int(mpz_t *z, mp_int_t val)
void mpz_or_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
size_t mpz_as_str_inpl(const mpz_t *z, unsigned int base, const char *prefix, char base_char, char comma, char *str)
mp_int_t mpz_hash(const mpz_t *z)
void mpz_set_from_int(mpz_t *z, mp_int_t src)
unsigned long long uint64_t
int32_t mpz_dbl_dig_signed_t
size_t mpz_set_from_str(mpz_t *z, const char *str, size_t len, bool neg, unsigned int base)
void mpz_sub_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
void mpz_set_from_ll(mpz_t *z, long long i, bool is_signed)
void mpz_deinit(mpz_t *z)
#define is_signed(typecode)
void mpz_set(mpz_t *dest, const mpz_t *src)
void mpz_shr_inpl(mpz_t *dest, const mpz_t *lhs, mp_uint_t rhs)
void mpz_mul_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
void mpz_add_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
void mpz_init_fixed_from_int(mpz_t *z, mpz_dig_t *dig, size_t dig_alloc, mp_int_t val)
void mpz_divmod_inpl(mpz_t *dest_quo, mpz_t *dest_rem, const mpz_t *lhs, const mpz_t *rhs)
void mpz_pow3_inpl(mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs, const mpz_t *mod)
bool mpz_as_uint_checked(const mpz_t *z, mp_uint_t *value)
void mpz_as_bytes(const mpz_t *z, bool big_endian, size_t len, byte *buf)
void mpz_not_inpl(mpz_t *dest, const mpz_t *z)
void mpz_init_zero(mpz_t *z)
void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf)