Numworks Epsilon  1.4.1
Graphing Calculator Operating System
mpz.h File Reference
#include <stdint.h>
#include "py/mpconfig.h"
#include "py/misc.h"

Go to the source code of this file.

Classes

struct  _mpz_t
 

Macros

#define MPZ_DIG_SIZE   (16)
 
#define MPZ_LONG_1   1L
 
#define MPZ_NUM_DIG_FOR_INT   ((sizeof(mp_int_t) * 8 + MPZ_DIG_SIZE - 1) / MPZ_DIG_SIZE)
 
#define MPZ_NUM_DIG_FOR_LL   ((sizeof(long long) * 8 + MPZ_DIG_SIZE - 1) / MPZ_DIG_SIZE)
 
#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);
 

Typedefs

typedef uint16_t mpz_dig_t
 
typedef uint32_t mpz_dbl_dig_t
 
typedef int32_t mpz_dbl_dig_signed_t
 
typedef struct _mpz_t mpz_t
 

Functions

void mpz_init_zero (mpz_t *z)
 
void mpz_init_from_int (mpz_t *z, mp_int_t val)
 
void mpz_init_fixed_from_int (mpz_t *z, mpz_dig_t *dig, size_t dig_alloc, mp_int_t val)
 
void mpz_deinit (mpz_t *z)
 
void mpz_set (mpz_t *dest, const mpz_t *src)
 
void mpz_set_from_int (mpz_t *z, mp_int_t src)
 
void mpz_set_from_ll (mpz_t *z, long long i, bool is_signed)
 
size_t mpz_set_from_str (mpz_t *z, const char *str, size_t len, bool neg, unsigned int base)
 
void mpz_set_from_bytes (mpz_t *z, bool big_endian, size_t len, const byte *buf)
 
int mpz_cmp (const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_abs_inpl (mpz_t *dest, const mpz_t *z)
 
void mpz_neg_inpl (mpz_t *dest, const mpz_t *z)
 
void mpz_not_inpl (mpz_t *dest, const mpz_t *z)
 
void mpz_shl_inpl (mpz_t *dest, const mpz_t *lhs, mp_uint_t rhs)
 
void mpz_shr_inpl (mpz_t *dest, const mpz_t *lhs, mp_uint_t rhs)
 
void mpz_add_inpl (mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_sub_inpl (mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_mul_inpl (mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_pow_inpl (mpz_t *dest, 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)
 
void mpz_and_inpl (mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_or_inpl (mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_xor_inpl (mpz_t *dest, const mpz_t *lhs, const mpz_t *rhs)
 
void mpz_divmod_inpl (mpz_t *dest_quo, mpz_t *dest_rem, const mpz_t *lhs, const mpz_t *rhs)
 
mp_int_t mpz_hash (const mpz_t *z)
 
bool mpz_as_int_checked (const mpz_t *z, mp_int_t *value)
 
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)
 
size_t mpz_as_str_inpl (const mpz_t *z, unsigned int base, const char *prefix, char base_char, char comma, char *str)
 

Macro Definition Documentation

◆ MPZ_CONST_INT

#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);

Definition at line 98 of file mpz.h.

◆ MPZ_DIG_SIZE

#define MPZ_DIG_SIZE   (16)

Definition at line 53 of file mpz.h.

◆ MPZ_LONG_1

#define MPZ_LONG_1   1L

Definition at line 82 of file mpz.h.

◆ MPZ_NUM_DIG_FOR_INT

#define MPZ_NUM_DIG_FOR_INT   ((sizeof(mp_int_t) * 8 + MPZ_DIG_SIZE - 1) / MPZ_DIG_SIZE)

Definition at line 86 of file mpz.h.

◆ MPZ_NUM_DIG_FOR_LL

#define MPZ_NUM_DIG_FOR_LL   ((sizeof(long long) * 8 + MPZ_DIG_SIZE - 1) / MPZ_DIG_SIZE)

Definition at line 87 of file mpz.h.

Typedef Documentation

◆ mpz_dbl_dig_signed_t

Definition at line 64 of file mpz.h.

◆ mpz_dbl_dig_t

Definition at line 63 of file mpz.h.

◆ mpz_dig_t

Definition at line 62 of file mpz.h.

◆ mpz_t

typedef struct _mpz_t mpz_t

Function Documentation

◆ mpz_abs_inpl()

void mpz_abs_inpl ( mpz_t dest,
const mpz_t z 
)

Definition at line 1076 of file mpz.c.

◆ mpz_add_inpl()

void mpz_add_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1171 of file mpz.c.

◆ mpz_and_inpl()

void mpz_and_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1220 of file mpz.c.

◆ mpz_as_bytes()

void mpz_as_bytes ( const mpz_t z,
bool  big_endian,
size_t  len,
byte buf 
)

Definition at line 1618 of file mpz.c.

◆ mpz_as_int_checked()

bool mpz_as_int_checked ( const mpz_t z,
mp_int_t value 
)

Definition at line 1576 of file mpz.c.

◆ mpz_as_str_inpl()

size_t mpz_as_str_inpl ( const mpz_t z,
unsigned int  base,
const char *  prefix,
char  base_char,
char  comma,
char *  str 
)

Definition at line 1679 of file mpz.c.

◆ mpz_as_uint_checked()

bool mpz_as_uint_checked ( const mpz_t z,
mp_uint_t value 
)

Definition at line 1596 of file mpz.c.

◆ mpz_cmp()

int mpz_cmp ( const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 958 of file mpz.c.

◆ mpz_deinit()

void mpz_deinit ( mpz_t z)

Definition at line 670 of file mpz.c.

◆ mpz_divmod_inpl()

void mpz_divmod_inpl ( mpz_t dest_quo,
mpz_t dest_rem,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1513 of file mpz.c.

◆ mpz_hash()

mp_int_t mpz_hash ( const mpz_t z)

Definition at line 1561 of file mpz.c.

◆ mpz_init_fixed_from_int()

void mpz_init_fixed_from_int ( mpz_t z,
mpz_dig_t dig,
size_t  dig_alloc,
mp_int_t  val 
)

Definition at line 661 of file mpz.c.

◆ mpz_init_from_int()

void mpz_init_from_int ( mpz_t z,
mp_int_t  val 
)

Definition at line 656 of file mpz.c.

◆ mpz_init_zero()

void mpz_init_zero ( mpz_t z)

Definition at line 648 of file mpz.c.

◆ mpz_mul_inpl()

void mpz_mul_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1326 of file mpz.c.

◆ mpz_neg_inpl()

void mpz_neg_inpl ( mpz_t dest,
const mpz_t z 
)

Definition at line 1086 of file mpz.c.

◆ mpz_not_inpl()

void mpz_not_inpl ( mpz_t dest,
const mpz_t z 
)

Definition at line 1096 of file mpz.c.

◆ mpz_or_inpl()

void mpz_or_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1254 of file mpz.c.

◆ mpz_pow3_inpl()

void mpz_pow3_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs,
const mpz_t mod 
)

Definition at line 1392 of file mpz.c.

◆ mpz_pow_inpl()

void mpz_pow_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1358 of file mpz.c.

◆ mpz_set()

void mpz_set ( mpz_t dest,
const mpz_t src 
)

Definition at line 751 of file mpz.c.

◆ mpz_set_from_bytes()

void mpz_set_from_bytes ( mpz_t z,
bool  big_endian,
size_t  len,
const byte buf 
)

Definition at line 909 of file mpz.c.

◆ mpz_set_from_int()

void mpz_set_from_int ( mpz_t z,
mp_int_t  src 
)

Definition at line 758 of file mpz.c.

◆ mpz_set_from_ll()

void mpz_set_from_ll ( mpz_t z,
long long  i,
bool  is_signed 
)

Definition at line 782 of file mpz.c.

◆ mpz_set_from_str()

size_t mpz_set_from_str ( mpz_t z,
const char *  str,
size_t  len,
bool  neg,
unsigned int  base 
)

Definition at line 873 of file mpz.c.

◆ mpz_shl_inpl()

void mpz_shl_inpl ( mpz_t dest,
const mpz_t lhs,
mp_uint_t  rhs 
)

Definition at line 1120 of file mpz.c.

◆ mpz_shr_inpl()

void mpz_shr_inpl ( mpz_t dest,
const mpz_t lhs,
mp_uint_t  rhs 
)

Definition at line 1133 of file mpz.c.

◆ mpz_sub_inpl()

void mpz_sub_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1192 of file mpz.c.

◆ mpz_xor_inpl()

void mpz_xor_inpl ( mpz_t dest,
const mpz_t lhs,
const mpz_t rhs 
)

Definition at line 1288 of file mpz.c.