libgpac
Documentation of the core library of GPAC
libbf.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include "cutils.h"
#include "libbf.h"
+ Include dependency graph for libbf.c:

Data Structures

union  Float64Union
 
struct  FastDivData
 
struct  BFNTTState
 

Macros

#define USE_FFT_MUL
 
#define USE_BF_DEC
 
#define FFT_MUL_THRESHOLD   100 /* in limbs of the smallest factor */
 
#define DIVNORM_LARGE_THRESHOLD   50
 
#define UDIV1NORM_THRESHOLD   3
 
#define FMT_LIMB1   "%" PRIx64
 
#define FMT_LIMB   "%016" PRIx64
 
#define PRId_LIMB   PRId64
 
#define PRIu_LIMB   PRIu64
 
#define FFT_MUL_R_OVERLAP_A   (1 << 0)
 
#define FFT_MUL_R_OVERLAP_B   (1 << 1)
 
#define FFT_MUL_R_NORESIZE   (1 << 2)
 
#define malloc(s)   malloc_is_forbidden(s)
 
#define free(p)   free_is_forbidden(p)
 
#define realloc(p, s)   realloc_is_forbidden(p, s)
 
#define BF_LOGIC_OR   0
 
#define BF_LOGIC_XOR   1
 
#define BF_LOGIC_AND   2
 
#define RADIXL_10   UINT64_C(10000000000000000000)
 
#define CHUD_A   13591409
 
#define CHUD_B   545140134
 
#define CHUD_C   640320
 
#define CHUD_BITS_PER_TERM   47
 
#define adddq(r1, r0, a1, a0)
 
#define subdq(r1, r0, a1, a0)
 
#define muldq(r1, r0, a, b)
 
#define divdq(q, r, a1, a0, b)
 
#define divdq_base(q, r, a1, a0)
 
#define fast_shr_rem_dec(q, r, a, shift)   q = fast_shr_dec(a, shift), r = a - q * mp_pow_dec[shift]
 
#define DIV_STATIC_ALLOC_LEN   16
 
#define NTT_MOD_LOG2_MIN   61
 
#define NTT_MOD_LOG2_MAX   62
 
#define NB_MODS   5
 
#define NTT_PROOT_2EXP   51
 
#define NTT_TRIG_K_MAX   19
 
#define STRIP_LEN   16
 

Typedefs

typedef intptr_t mp_size_t
 
typedef int bf_op2_func_t(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
typedef int ZivFunc(bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
typedef limb_t NTTLimb
 

Functions

static no_inline int fft_mul (bf_context_t *s, bf_t *res, limb_t *a_tab, limb_t a_len, limb_t *b_tab, limb_t b_len, int mul_flags)
 
static void fft_clear_cache (bf_context_t *s)
 
static limb_t get_digit (const limb_t *tab, limb_t len, slimb_t pos)
 
static int clz (limb_t a)
 
static int ctz (limb_t a)
 
static int ceil_log2 (limb_t a)
 
static slimb_t ceil_div (slimb_t a, slimb_t b)
 
static slimb_t floor_div (slimb_t a, slimb_t b)
 
static limb_t smod (slimb_t a, slimb_t b)
 
static slimb_t sat_add (slimb_t a, slimb_t b)
 
void bf_context_init (bf_context_t *s, bf_realloc_func_t *realloc_func, void *realloc_opaque)
 
void bf_context_end (bf_context_t *s)
 
void bf_init (bf_context_t *s, bf_t *r)
 
int bf_resize (bf_t *r, limb_t len)
 
int bf_set_ui (bf_t *r, uint64_t a)
 
int bf_set_si (bf_t *r, int64_t a)
 
void bf_set_nan (bf_t *r)
 
void bf_set_zero (bf_t *r, int is_neg)
 
void bf_set_inf (bf_t *r, int is_neg)
 
int bf_set (bf_t *r, const bf_t *a)
 
void bf_move (bf_t *r, bf_t *a)
 
static limb_t get_limbz (const bf_t *a, limb_t idx)
 
static limb_t get_bits (const limb_t *tab, limb_t len, slimb_t pos)
 
static limb_t get_bit (const limb_t *tab, limb_t len, slimb_t pos)
 
static limb_t limb_mask (int start, int last)
 
static limb_t mp_scan_nz (const limb_t *tab, mp_size_t n)
 
static limb_t scan_bit_nz (const bf_t *r, slimb_t bit_pos)
 
static int bf_get_rnd_add (int *pret, const bf_t *r, limb_t l, slimb_t prec, int rnd_mode)
 
static int bf_set_overflow (bf_t *r, int sign, limb_t prec, bf_flags_t flags)
 
static int __bf_round (bf_t *r, limb_t prec1, bf_flags_t flags, limb_t l, int ret)
 
int bf_normalize_and_round (bf_t *r, limb_t prec1, bf_flags_t flags)
 
int bf_can_round (const bf_t *a, slimb_t prec, bf_rnd_t rnd_mode, slimb_t k)
 
int bf_round (bf_t *r, limb_t prec, bf_flags_t flags)
 
static __maybe_unused void dump_limbs (const char *str, const limb_t *tab, limb_t n)
 
void mp_print_str (const char *str, const limb_t *tab, limb_t n)
 
static __maybe_unused void mp_print_str_h (const char *str, const limb_t *tab, limb_t n, limb_t high)
 
void bf_print_str (const char *str, const bf_t *a)
 
int bf_cmpu (const bf_t *a, const bf_t *b)
 
int bf_cmp_full (const bf_t *a, const bf_t *b)
 
int bf_cmp (const bf_t *a, const bf_t *b)
 
static limb_t count_cancelled_bits (const bf_t *a, const bf_t *b)
 
static int bf_add_internal (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int b_neg)
 
static int __bf_add (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
static int __bf_sub (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
limb_t mp_add (limb_t *res, const limb_t *op1, const limb_t *op2, limb_t n, limb_t carry)
 
limb_t mp_add_ui (limb_t *tab, limb_t b, size_t n)
 
limb_t mp_sub (limb_t *res, const limb_t *op1, const limb_t *op2, mp_size_t n, limb_t carry)
 
static limb_t mp_neg (limb_t *res, const limb_t *op2, mp_size_t n, limb_t carry)
 
limb_t mp_sub_ui (limb_t *tab, limb_t b, mp_size_t n)
 
static limb_t mp_shr (limb_t *tab_r, const limb_t *tab, mp_size_t n, int shift, limb_t high)
 
static limb_t mp_mul1 (limb_t *tabr, const limb_t *taba, limb_t n, limb_t b, limb_t l)
 
static limb_t mp_add_mul1 (limb_t *tabr, const limb_t *taba, limb_t n, limb_t b)
 
static void mp_mul_basecase (limb_t *result, const limb_t *op1, limb_t op1_size, const limb_t *op2, limb_t op2_size)
 
int mp_mul (bf_context_t *s, limb_t *result, const limb_t *op1, limb_t op1_size, const limb_t *op2, limb_t op2_size)
 
static limb_t mp_sub_mul1 (limb_t *tabr, const limb_t *taba, limb_t n, limb_t b)
 
static limb_t udiv1norm_init (limb_t d)
 
static limb_t udiv1norm (limb_t *pr, limb_t a1, limb_t a0, limb_t d, limb_t d_inv)
 
static limb_t mp_div1norm (limb_t *tabr, const limb_t *taba, limb_t n, limb_t b, limb_t r)
 
static int mp_divnorm_large (bf_context_t *s, limb_t *tabq, limb_t *taba, limb_t na, const limb_t *tabb, limb_t nb)
 
static int mp_divnorm (bf_context_t *s, limb_t *tabq, limb_t *taba, limb_t na, const limb_t *tabb, limb_t nb)
 
int mp_recip (bf_context_t *s, limb_t *tabr, const limb_t *taba, limb_t n)
 
static int mp_cmp (const limb_t *taba, const limb_t *tabb, mp_size_t n)
 
int bf_mul (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
int bf_mul_2exp (bf_t *r, slimb_t e, limb_t prec, bf_flags_t flags)
 
slimb_t bf_get_exp_min (const bf_t *a)
 
static void bf_tdivremu (bf_t *q, bf_t *r, const bf_t *a, const bf_t *b)
 
static int __bf_div (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
int bf_divrem (bf_t *q, bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int rnd_mode)
 
int bf_rem (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int rnd_mode)
 
static int bf_get_limb (slimb_t *pres, const bf_t *a, int flags)
 
int bf_remquo (slimb_t *pq, bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, int rnd_mode)
 
static __maybe_unused limb_t mul_mod (limb_t a, limb_t b, limb_t m)
 
static limb_t mp_sqrtrem1 (limb_t *pr, limb_t a)
 
limb_t bf_isqrt (limb_t a)
 
static limb_t mp_sqrtrem2 (limb_t *tabs, limb_t *taba)
 
static int mp_sqrtrem_rec (bf_context_t *s, limb_t *tabs, limb_t *taba, limb_t n, limb_t *tmp_buf, limb_t *prh)
 
int mp_sqrtrem (bf_context_t *s, limb_t *tabs, limb_t *taba, limb_t n)
 
int bf_sqrtrem (bf_t *r, bf_t *rem1, const bf_t *a)
 
int bf_sqrt (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static no_inline int bf_op2 (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags, bf_op2_func_t *func)
 
int bf_add (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
int bf_sub (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
int bf_div (bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)
 
int bf_mul_ui (bf_t *r, const bf_t *a, uint64_t b1, limb_t prec, bf_flags_t flags)
 
int bf_mul_si (bf_t *r, const bf_t *a, int64_t b1, limb_t prec, bf_flags_t flags)
 
int bf_add_si (bf_t *r, const bf_t *a, int64_t b1, limb_t prec, bf_flags_t flags)
 
static int bf_pow_ui (bf_t *r, const bf_t *a, limb_t b, limb_t prec, bf_flags_t flags)
 
static int bf_pow_ui_ui (bf_t *r, limb_t a1, limb_t b, limb_t prec, bf_flags_t flags)
 
int bf_rint (bf_t *r, int rnd_mode)
 
static limb_t bf_logic_op1 (limb_t a, limb_t b, int op)
 
static int bf_logic_op (bf_t *r, const bf_t *a1, const bf_t *b1, int op)
 
int bf_logic_or (bf_t *r, const bf_t *a, const bf_t *b)
 
int bf_logic_xor (bf_t *r, const bf_t *a, const bf_t *b)
 
int bf_logic_and (bf_t *r, const bf_t *a, const bf_t *b)
 
int bf_get_float64 (const bf_t *a, double *pres, bf_rnd_t rnd_mode)
 
int bf_set_float64 (bf_t *a, double d)
 
int bf_get_int32 (int *pres, const bf_t *a, int flags)
 
int bf_get_int64 (int64_t *pres, const bf_t *a, int flags)
 
int bf_get_uint64 (uint64_t *pres, const bf_t *a)
 
static limb_t get_limb_radix (int radix)
 
static int bf_integer_from_radix_rec (bf_t *r, const limb_t *tab, limb_t n, int level, limb_t n0, limb_t radix, bf_t *pow_tab)
 
static int bf_integer_from_radix (bf_t *r, const limb_t *tab, limb_t n, limb_t radix)
 
int bf_mul_pow_radix (bf_t *r, const bf_t *T, limb_t radix, slimb_t expn, limb_t prec, bf_flags_t flags)
 
static int to_digit (int c)
 
static int bf_add_limb (bf_t *a, slimb_t *ppos, limb_t v)
 
static int bf_tolower (int c)
 
static int strcasestart (const char *str, const char *val, const char **ptr)
 
static int bf_atof_internal (bf_t *r, slimb_t *pexponent, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags, BOOL is_dec)
 
int bf_atof2 (bf_t *r, slimb_t *pexponent, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags)
 
int bf_atof (bf_t *r, const char *str, const char **pnext, int radix, limb_t prec, bf_flags_t flags)
 
slimb_t bf_mul_log2_radix (slimb_t a1, unsigned int radix, int is_inv, int is_ceil1)
 
static int bf_integer_to_radix_rec (bf_t *pow_tab, limb_t *out, const bf_t *a, limb_t n, int level, limb_t n0, limb_t radixl, unsigned int radixl_bits)
 
static int bf_integer_to_radix (bf_t *r, const bf_t *a, limb_t radixl)
 
static int bf_convert_to_radix (bf_t *r, slimb_t *pE, const bf_t *a, int radix, limb_t P, bf_rnd_t rnd_mode, BOOL is_fixed_exponent)
 
static void limb_to_a (char *buf, limb_t n, unsigned int radix, int len)
 
static void limb_to_a2 (char *buf, limb_t n, unsigned int radix_bits, int len)
 
static void output_digits (DynBuf *s, const bf_t *a1, int radix, limb_t n_digits, limb_t dot_pos, BOOL is_dec)
 
static void * bf_dbuf_realloc (void *opaque, void *ptr, size_t size)
 
static char * bf_ftoa_internal (size_t *plen, const bf_t *a2, int radix, limb_t prec, bf_flags_t flags, BOOL is_dec)
 
char * bf_ftoa (size_t *plen, const bf_t *a, int radix, limb_t prec, bf_flags_t flags)
 
static void bf_const_log2_rec (bf_t *T, bf_t *P, bf_t *Q, limb_t n1, limb_t n2, BOOL need_P)
 
static void bf_const_log2_internal (bf_t *T, limb_t prec)
 
static void chud_bs (bf_t *P, bf_t *Q, bf_t *G, int64_t a, int64_t b, int need_g, limb_t prec)
 
static void bf_const_pi_internal (bf_t *Q, limb_t prec)
 
static int bf_const_get (bf_t *T, limb_t prec, bf_flags_t flags, BFConstCache *c, void(*func)(bf_t *res, limb_t prec), int sign)
 
static void bf_const_free (BFConstCache *c)
 
int bf_const_log2 (bf_t *T, limb_t prec, bf_flags_t flags)
 
static int bf_const_pi_signed (bf_t *T, int sign, limb_t prec, bf_flags_t flags)
 
int bf_const_pi (bf_t *T, limb_t prec, bf_flags_t flags)
 
void bf_clear_cache (bf_context_t *s)
 
static int bf_ziv_rounding (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags, ZivFunc *f, void *opaque)
 
static int bf_add_epsilon (bf_t *r, const bf_t *a, slimb_t e, int e_sign, limb_t prec, int flags)
 
static int bf_exp_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
static int check_exp_underflow_overflow (bf_context_t *s, bf_t *r, const bf_t *a_low, const bf_t *a_high, limb_t prec, bf_flags_t flags)
 
int bf_exp (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static int bf_log_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
int bf_log (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static int bf_pow_generic (bf_t *r, const bf_t *x, limb_t prec, void *opaque)
 
static int bf_pow_int (bf_t *r, const bf_t *x, limb_t prec, void *opaque)
 
static BOOL check_exact_power2n (bf_t *r, const bf_t *x, slimb_t n)
 
int bf_pow (bf_t *r, const bf_t *x, const bf_t *y, limb_t prec, bf_flags_t flags)
 
static void bf_sqrt_sin (bf_t *r, const bf_t *x, limb_t prec1)
 
static int bf_sincos (bf_t *s, bf_t *c, const bf_t *a, limb_t prec)
 
static int bf_cos_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
int bf_cos (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static int bf_sin_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
int bf_sin (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static int bf_tan_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
int bf_tan (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static int bf_atan_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
int bf_atan (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static int bf_atan2_internal (bf_t *r, const bf_t *y, limb_t prec, void *opaque)
 
int bf_atan2 (bf_t *r, const bf_t *y, const bf_t *x, limb_t prec, bf_flags_t flags)
 
static int bf_asin_internal (bf_t *r, const bf_t *a, limb_t prec, void *opaque)
 
int bf_asin (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
int bf_acos (bf_t *r, const bf_t *a, limb_t prec, bf_flags_t flags)
 
static __maybe_unused limb_t shrd (limb_t low, limb_t high, long shift)
 
static __maybe_unused limb_t shld (limb_t a1, limb_t a0, long shift)
 
static __maybe_unused void fast_udiv_init (FastDivData *s, limb_t d)
 
static limb_t fast_udiv (limb_t a, const FastDivData *s)
 
static limb_t fast_shr_dec (limb_t a, int shift)
 
limb_t mp_add_dec (limb_t *res, const limb_t *op1, const limb_t *op2, mp_size_t n, limb_t carry)
 
limb_t mp_add_ui_dec (limb_t *tab, limb_t b, mp_size_t n)
 
limb_t mp_sub_dec (limb_t *res, const limb_t *op1, const limb_t *op2, mp_size_t n, limb_t carry)
 
limb_t mp_sub_ui_dec (limb_t *tab, limb_t b, mp_size_t n)
 
limb_t mp_mul1_dec (limb_t *tabr, const limb_t *taba, mp_size_t n, limb_t b, limb_t l)
 
limb_t mp_add_mul1_dec (limb_t *tabr, const limb_t *taba, mp_size_t n, limb_t b)
 
limb_t mp_sub_mul1_dec (limb_t *tabr, const limb_t *taba, mp_size_t n, limb_t b)
 
void mp_mul_basecase_dec (limb_t *result, const limb_t *op1, mp_size_t op1_size, const limb_t *op2, mp_size_t op2_size)
 
limb_t mp_div1_dec (limb_t *tabr, const limb_t *taba, mp_size_t na, limb_t b, limb_t r)
 
static __maybe_unused void mp_print_str_dec (const char *str, const limb_t *tab, slimb_t n)
 
static __maybe_unused void mp_print_str_h_dec (const char *str, const limb_t *tab, slimb_t n, limb_t high)
 
static int mp_div_dec (bf_context_t *s, limb_t *tabq, limb_t *taba, mp_size_t na, const limb_t *tabb1, mp_size_t nb)
 
static limb_t mp_shr_dec (limb_t *tab_r, const limb_t *tab, mp_size_t n, limb_t shift, limb_t high)
 
static limb_t mp_shl_dec (limb_t *tab_r, const limb_t *tab, mp_size_t n, limb_t shift, limb_t low)
 
static limb_t mp_sqrtrem2_dec (limb_t *tabs, limb_t *taba)
 
static limb_t mp_sqrtrem_rec_dec (limb_t *tabs, limb_t *taba, limb_t n, limb_t *tmp_buf)
 
int mp_sqrtrem_dec (bf_context_t *s, limb_t *tabs, limb_t *taba, limb_t n)
 
static int clz_dec (limb_t a)
 
void bfdec_print_str (const char *str, const bfdec_t *a)
 
static limb_t scan_digit_nz (const bfdec_t *r, slimb_t bit_pos)
 
static int bfdec_get_rnd_add (int *pret, const bfdec_t *r, limb_t l, slimb_t prec, int rnd_mode)
 
static int __bfdec_round (bfdec_t *r, limb_t prec1, bf_flags_t flags, limb_t l)
 
int bfdec_round (bfdec_t *r, limb_t prec, bf_flags_t flags)
 
int bfdec_normalize_and_round (bfdec_t *r, limb_t prec1, bf_flags_t flags)
 
int bfdec_set_ui (bfdec_t *r, uint64_t v)
 
int bfdec_set_si (bfdec_t *r, int64_t v)
 
static int bfdec_add_internal (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags, int b_neg)
 
static int __bfdec_add (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
static int __bfdec_sub (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
int bfdec_add (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
int bfdec_sub (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
int bfdec_mul (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
int bfdec_mul_si (bfdec_t *r, const bfdec_t *a, int64_t b1, limb_t prec, bf_flags_t flags)
 
int bfdec_add_si (bfdec_t *r, const bfdec_t *a, int64_t b1, limb_t prec, bf_flags_t flags)
 
static int __bfdec_div (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
int bfdec_div (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags)
 
static void bfdec_tdivremu (bf_context_t *s, bfdec_t *q, bfdec_t *r, const bfdec_t *a, const bfdec_t *b)
 
int bfdec_divrem (bfdec_t *q, bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags, int rnd_mode)
 
int bfdec_rem (bfdec_t *r, const bfdec_t *a, const bfdec_t *b, limb_t prec, bf_flags_t flags, int rnd_mode)
 
int bfdec_rint (bfdec_t *r, int rnd_mode)
 
int bfdec_sqrt (bfdec_t *r, const bfdec_t *a, limb_t prec, bf_flags_t flags)
 
int bfdec_get_int32 (int *pres, const bfdec_t *a)
 
int bfdec_pow_ui (bfdec_t *r, const bfdec_t *a, limb_t b)
 
char * bfdec_ftoa (size_t *plen, const bfdec_t *a, limb_t prec, bf_flags_t flags)
 
int bfdec_atof (bfdec_t *r, const char *str, const char **pnext, limb_t prec, bf_flags_t flags)
 
static void put_bits (limb_t *tab, limb_t len, slimb_t pos, limb_t val)
 
static NTTLimbget_trig (BFNTTState *s, int k, int inverse, int m_idx)
 
static limb_t add_mod (limb_t a, limb_t b, limb_t m)
 
static limb_t sub_mod (limb_t a, limb_t b, limb_t m)
 
static limb_t mod_fast (dlimb_t r, limb_t m, limb_t m_inv)
 
static limb_t mul_mod_fast (limb_t a, limb_t b, limb_t m, limb_t m_inv)
 
static limb_t init_mul_mod_fast (limb_t m)
 
static limb_t mul_mod_fast2 (limb_t a, limb_t b, limb_t m, limb_t b_inv)
 
static limb_t mul_mod_fast3 (limb_t a, limb_t b, limb_t m, limb_t b_inv)
 
static limb_t init_mul_mod_fast2 (limb_t b, limb_t m)
 
static void * ntt_malloc (BFNTTState *s, size_t size)
 
static void ntt_free (BFNTTState *s, void *ptr)
 
static limb_t ntt_limb_to_int (NTTLimb a, limb_t m)
 
static NTTLimb int_to_ntt_limb (slimb_t a, limb_t m)
 
static no_inline int ntt_fft (BFNTTState *s, NTTLimb *out_buf, NTTLimb *in_buf, NTTLimb *tmp_buf, int fft_len_log2, int inverse, int m_idx)
 
static void ntt_vec_mul (BFNTTState *s, NTTLimb *tab1, NTTLimb *tab2, int fft_len_log2, int k_tot, int m_idx)
 
static no_inline void mul_trig (NTTLimb *buf, limb_t n, limb_t c_mul, limb_t m, limb_t m_inv)
 
static int ntt_fft_partial (BFNTTState *s, NTTLimb *buf1, int k1, int k2, limb_t n1, limb_t n2, int inverse, limb_t m_idx)
 
static int ntt_conv (BFNTTState *s, NTTLimb *buf1, NTTLimb *buf2, int k, int k_tot, limb_t m_idx)
 
static no_inline void limb_to_ntt (BFNTTState *s, NTTLimb *tabr, limb_t fft_len, const limb_t *taba, limb_t a_len, int dpl, int first_m_idx, int nb_mods)
 
static no_inline void ntt_to_limb (BFNTTState *s, limb_t *tabr, limb_t r_len, const NTTLimb *buf, int fft_len_log2, int dpl, int nb_mods)
 
static int ntt_static_init (bf_context_t *s1)
 
int bf_get_fft_size (int *pdpl, int *pnb_mods, limb_t len)
 

Variables

static const uint16_t sqrt_table [192]
 
static const uint8_t digits_per_limb_table [BF_RADIX_MAX - 1]
 
static const uint32_t inv_log2_radix [BF_RADIX_MAX - 1][LIMB_BITS/32+1]
 
static const limb_t log2_radix [BF_RADIX_MAX - 1]
 
const limb_t mp_pow_dec [LIMB_DIGITS+1]
 
static const FastDivData mp_pow_div [LIMB_DIGITS+1]
 
static const int ntt_int_bits [NB_MODS] = { 307, 246, 185, 123, 61, }
 
static const limb_t ntt_mods [NB_MODS]
 
static const limb_t ntt_proot [2][NB_MODS]
 
static const limb_t ntt_mods_cr [NB_MODS *(NB_MODS - 1)/2]
 

Data Structure Documentation

◆ Float64Union

union Float64Union
Data Fields
double d
uint64_t u

◆ FastDivData

struct FastDivData
Data Fields
limb_t m1
int8_t shift1
int8_t shift2

◆ BFNTTState

struct BFNTTState
+ Collaboration diagram for BFNTTState:
Data Fields
bf_context_t * ctx
limb_t ntt_mods_div[NB_MODS]
limb_t ntt_proot_pow[NB_MODS][2][NTT_PROOT_2EXP+1]
limb_t ntt_proot_pow_inv[NB_MODS][2][NTT_PROOT_2EXP+1]
NTTLimb * ntt_trig[NB_MODS][2][NTT_TRIG_K_MAX+1]
limb_t ntt_len_inv[NB_MODS][NTT_PROOT_2EXP+1][2]
limb_t ntt_mods_cr_inv[NB_MODS *(NB_MODS - 1)/2]

Macro Definition Documentation

◆ USE_FFT_MUL

#define USE_FFT_MUL

◆ USE_BF_DEC

#define USE_BF_DEC

◆ FFT_MUL_THRESHOLD

#define FFT_MUL_THRESHOLD   100 /* in limbs of the smallest factor */

◆ DIVNORM_LARGE_THRESHOLD

#define DIVNORM_LARGE_THRESHOLD   50

◆ UDIV1NORM_THRESHOLD

#define UDIV1NORM_THRESHOLD   3

◆ FMT_LIMB1

#define FMT_LIMB1   "%" PRIx64

◆ FMT_LIMB

#define FMT_LIMB   "%016" PRIx64

◆ PRId_LIMB

#define PRId_LIMB   PRId64

◆ PRIu_LIMB

#define PRIu_LIMB   PRIu64

◆ FFT_MUL_R_OVERLAP_A

#define FFT_MUL_R_OVERLAP_A   (1 << 0)

◆ FFT_MUL_R_OVERLAP_B

#define FFT_MUL_R_OVERLAP_B   (1 << 1)

◆ FFT_MUL_R_NORESIZE

#define FFT_MUL_R_NORESIZE   (1 << 2)

◆ malloc

#define malloc (   s)    malloc_is_forbidden(s)

◆ free

#define free (   p)    free_is_forbidden(p)

◆ realloc

#define realloc (   p,
 
)    realloc_is_forbidden(p, s)

◆ BF_LOGIC_OR

#define BF_LOGIC_OR   0

◆ BF_LOGIC_XOR

#define BF_LOGIC_XOR   1

◆ BF_LOGIC_AND

#define BF_LOGIC_AND   2

◆ RADIXL_10

#define RADIXL_10   UINT64_C(10000000000000000000)

◆ CHUD_A

#define CHUD_A   13591409

◆ CHUD_B

#define CHUD_B   545140134

◆ CHUD_C

#define CHUD_C   640320

◆ CHUD_BITS_PER_TERM

#define CHUD_BITS_PER_TERM   47

◆ adddq

#define adddq (   r1,
  r0,
  a1,
  a0 
)
Value:
do { \
limb_t __t = r0; \
r0 += (a0); \
r1 += (a1) + (r0 < __t); \
} while (0)

◆ subdq

#define subdq (   r1,
  r0,
  a1,
  a0 
)
Value:
do { \
limb_t __t = r0; \
r0 -= (a0); \
r1 -= (a1) + (r0 > __t); \
} while (0)

◆ muldq

#define muldq (   r1,
  r0,
  a,
 
)
Value:
do { \
unsigned __int128 __t; \
__t = (unsigned __int128)(a) * (unsigned __int128)(b); \
r0 = __t; \
r1 = __t >> 64; \
} while (0)

◆ divdq

#define divdq (   q,
  r,
  a1,
  a0,
 
)
Value:
do { \
unsigned __int128 __t; \
limb_t __b = (b); \
__t = ((unsigned __int128)(a1) << 64) | (a0); \
q = __t / __b; \
r = __t % __b; \
} while (0)

◆ divdq_base

#define divdq_base (   q,
  r,
  a1,
  a0 
)
Value:
do {\
uint64_t __a0, __a1, __t0, __t1, __b = BF_DEC_BASE; \
__a0 = a0;\
__a1 = a1;\
__t0 = __a1;\
__t0 = shld(__t0, __a0, 1);\
muldq(q, __t1, __t0, UINT64_C(17014118346046923173)); \
muldq(__t1, __t0, q, __b);\
subdq(__a1, __a0, __t1, __t0);\
subdq(__a1, __a0, 1, __b * 2); \
__t0 = (slimb_t)__a1 >> 1; \
q += 2 + __t0;\
adddq(__a1, __a0, 0, __b & __t0);\
q += __a1; \
__a0 += __b & __a1; \
r = __a0;\
} while(0)
static __maybe_unused limb_t shld(limb_t a1, limb_t a0, long shift)
Definition: libbf.c:5402
int64_t slimb_t
Definition: libbf.h:41
#define BF_DEC_BASE
Definition: libbf.h:48

◆ fast_shr_rem_dec

#define fast_shr_rem_dec (   q,
  r,
  a,
  shift 
)    q = fast_shr_dec(a, shift), r = a - q * mp_pow_dec[shift]

◆ DIV_STATIC_ALLOC_LEN

#define DIV_STATIC_ALLOC_LEN   16

◆ NTT_MOD_LOG2_MIN

#define NTT_MOD_LOG2_MIN   61

◆ NTT_MOD_LOG2_MAX

#define NTT_MOD_LOG2_MAX   62

◆ NB_MODS

#define NB_MODS   5

◆ NTT_PROOT_2EXP

#define NTT_PROOT_2EXP   51

◆ NTT_TRIG_K_MAX

#define NTT_TRIG_K_MAX   19

◆ STRIP_LEN

#define STRIP_LEN   16

Typedef Documentation

◆ mp_size_t

typedef intptr_t mp_size_t

◆ bf_op2_func_t

typedef int bf_op2_func_t(bf_t *r, const bf_t *a, const bf_t *b, limb_t prec, bf_flags_t flags)

◆ ZivFunc

typedef int ZivFunc(bf_t *r, const bf_t *a, limb_t prec, void *opaque)

◆ NTTLimb

typedef limb_t NTTLimb

Function Documentation

◆ fft_mul()

static no_inline int fft_mul ( bf_context_t s,
bf_t res,
limb_t a_tab,
limb_t  a_len,
limb_t b_tab,
limb_t  b_len,
int  mul_flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fft_clear_cache()

void fft_clear_cache ( bf_context_t s)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_digit()

static limb_t get_digit ( const limb_t tab,
limb_t  len,
slimb_t  pos 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clz()

static int clz ( limb_t  a)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ctz()

static int ctz ( limb_t  a)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ceil_log2()

static int ceil_log2 ( limb_t  a)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ceil_div()

static slimb_t ceil_div ( slimb_t  a,
slimb_t  b 
)
static
+ Here is the caller graph for this function:

◆ floor_div()

static slimb_t floor_div ( slimb_t  a,
slimb_t  b 
)
static
+ Here is the caller graph for this function:

◆ smod()

static limb_t smod ( slimb_t  a,
slimb_t  b 
)
static
+ Here is the caller graph for this function:

◆ sat_add()

static slimb_t sat_add ( slimb_t  a,
slimb_t  b 
)
static
+ Here is the caller graph for this function:

◆ bf_context_init()

void bf_context_init ( bf_context_t s,
bf_realloc_func_t realloc_func,
void *  realloc_opaque 
)
+ Here is the caller graph for this function:

◆ bf_context_end()

void bf_context_end ( bf_context_t s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_init()

void bf_init ( bf_context_t s,
bf_t r 
)
+ Here is the caller graph for this function:

◆ bf_resize()

int bf_resize ( bf_t r,
limb_t  len 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_ui()

int bf_set_ui ( bf_t r,
uint64_t  a 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_si()

int bf_set_si ( bf_t r,
int64_t  a 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_nan()

void bf_set_nan ( bf_t r)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_zero()

void bf_set_zero ( bf_t r,
int  is_neg 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_inf()

void bf_set_inf ( bf_t r,
int  is_neg 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set()

int bf_set ( bf_t r,
const bf_t a 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_move()

void bf_move ( bf_t r,
bf_t a 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_limbz()

static limb_t get_limbz ( const bf_t a,
limb_t  idx 
)
static
+ Here is the caller graph for this function:

◆ get_bits()

static limb_t get_bits ( const limb_t tab,
limb_t  len,
slimb_t  pos 
)
static
+ Here is the caller graph for this function:

◆ get_bit()

static limb_t get_bit ( const limb_t tab,
limb_t  len,
slimb_t  pos 
)
static
+ Here is the caller graph for this function:

◆ limb_mask()

static limb_t limb_mask ( int  start,
int  last 
)
static
+ Here is the caller graph for this function:

◆ mp_scan_nz()

static limb_t mp_scan_nz ( const limb_t tab,
mp_size_t  n 
)
static
+ Here is the caller graph for this function:

◆ scan_bit_nz()

static limb_t scan_bit_nz ( const bf_t r,
slimb_t  bit_pos 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_get_rnd_add()

static int bf_get_rnd_add ( int *  pret,
const bf_t r,
limb_t  l,
slimb_t  prec,
int  rnd_mode 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_overflow()

static int bf_set_overflow ( bf_t r,
int  sign,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bf_round()

static int __bf_round ( bf_t r,
limb_t  prec1,
bf_flags_t  flags,
limb_t  l,
int  ret 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_normalize_and_round()

int bf_normalize_and_round ( bf_t r,
limb_t  prec1,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_can_round()

int bf_can_round ( const bf_t a,
slimb_t  prec,
bf_rnd_t  rnd_mode,
slimb_t  k 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_round()

int bf_round ( bf_t r,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_limbs()

static __maybe_unused void dump_limbs ( const char *  str,
const limb_t tab,
limb_t  n 
)
static

◆ mp_print_str()

void mp_print_str ( const char *  str,
const limb_t tab,
limb_t  n 
)
+ Here is the caller graph for this function:

◆ mp_print_str_h()

static __maybe_unused void mp_print_str_h ( const char *  str,
const limb_t tab,
limb_t  n,
limb_t  high 
)
static
+ Here is the caller graph for this function:

◆ bf_print_str()

void bf_print_str ( const char *  str,
const bf_t a 
)
+ Here is the caller graph for this function:

◆ bf_cmpu()

int bf_cmpu ( const bf_t a,
const bf_t b 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_cmp_full()

int bf_cmp_full ( const bf_t a,
const bf_t b 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_cmp()

int bf_cmp ( const bf_t a,
const bf_t b 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ count_cancelled_bits()

static limb_t count_cancelled_bits ( const bf_t a,
const bf_t b 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_add_internal()

static int bf_add_internal ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags,
int  b_neg 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bf_add()

static int __bf_add ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bf_sub()

static int __bf_sub ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_add()

limb_t mp_add ( limb_t res,
const limb_t op1,
const limb_t op2,
limb_t  n,
limb_t  carry 
)
+ Here is the caller graph for this function:

◆ mp_add_ui()

limb_t mp_add_ui ( limb_t tab,
limb_t  b,
size_t  n 
)
+ Here is the caller graph for this function:

◆ mp_sub()

limb_t mp_sub ( limb_t res,
const limb_t op1,
const limb_t op2,
mp_size_t  n,
limb_t  carry 
)
+ Here is the caller graph for this function:

◆ mp_neg()

static limb_t mp_neg ( limb_t res,
const limb_t op2,
mp_size_t  n,
limb_t  carry 
)
static
+ Here is the caller graph for this function:

◆ mp_sub_ui()

limb_t mp_sub_ui ( limb_t tab,
limb_t  b,
mp_size_t  n 
)
+ Here is the caller graph for this function:

◆ mp_shr()

static limb_t mp_shr ( limb_t tab_r,
const limb_t tab,
mp_size_t  n,
int  shift,
limb_t  high 
)
static
+ Here is the caller graph for this function:

◆ mp_mul1()

static limb_t mp_mul1 ( limb_t tabr,
const limb_t taba,
limb_t  n,
limb_t  b,
limb_t  l 
)
static
+ Here is the caller graph for this function:

◆ mp_add_mul1()

static limb_t mp_add_mul1 ( limb_t tabr,
const limb_t taba,
limb_t  n,
limb_t  b 
)
static
+ Here is the caller graph for this function:

◆ mp_mul_basecase()

static void mp_mul_basecase ( limb_t result,
const limb_t op1,
limb_t  op1_size,
const limb_t op2,
limb_t  op2_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_mul()

int mp_mul ( bf_context_t s,
limb_t result,
const limb_t op1,
limb_t  op1_size,
const limb_t op2,
limb_t  op2_size 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_sub_mul1()

static limb_t mp_sub_mul1 ( limb_t tabr,
const limb_t taba,
limb_t  n,
limb_t  b 
)
static
+ Here is the caller graph for this function:

◆ udiv1norm_init()

static limb_t udiv1norm_init ( limb_t  d)
static
+ Here is the caller graph for this function:

◆ udiv1norm()

static limb_t udiv1norm ( limb_t pr,
limb_t  a1,
limb_t  a0,
limb_t  d,
limb_t  d_inv 
)
static
+ Here is the caller graph for this function:

◆ mp_div1norm()

static limb_t mp_div1norm ( limb_t tabr,
const limb_t taba,
limb_t  n,
limb_t  b,
limb_t  r 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_divnorm_large()

static int mp_divnorm_large ( bf_context_t s,
limb_t tabq,
limb_t taba,
limb_t  na,
const limb_t tabb,
limb_t  nb 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_divnorm()

static int mp_divnorm ( bf_context_t s,
limb_t tabq,
limb_t taba,
limb_t  na,
const limb_t tabb,
limb_t  nb 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_recip()

int mp_recip ( bf_context_t s,
limb_t tabr,
const limb_t taba,
limb_t  n 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_cmp()

static int mp_cmp ( const limb_t taba,
const limb_t tabb,
mp_size_t  n 
)
static
+ Here is the caller graph for this function:

◆ bf_mul()

int bf_mul ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_mul_2exp()

int bf_mul_2exp ( bf_t r,
slimb_t  e,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_get_exp_min()

slimb_t bf_get_exp_min ( const bf_t a)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_tdivremu()

static void bf_tdivremu ( bf_t q,
bf_t r,
const bf_t a,
const bf_t b 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bf_div()

static int __bf_div ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_divrem()

int bf_divrem ( bf_t q,
bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags,
int  rnd_mode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_rem()

int bf_rem ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags,
int  rnd_mode 
)
+ Here is the call graph for this function:

◆ bf_get_limb()

static int bf_get_limb ( slimb_t pres,
const bf_t a,
int  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_remquo()

int bf_remquo ( slimb_t pq,
bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags,
int  rnd_mode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mul_mod()

static __maybe_unused limb_t mul_mod ( limb_t  a,
limb_t  b,
limb_t  m 
)
static
+ Here is the caller graph for this function:

◆ mp_sqrtrem1()

static limb_t mp_sqrtrem1 ( limb_t pr,
limb_t  a 
)
static
+ Here is the caller graph for this function:

◆ bf_isqrt()

limb_t bf_isqrt ( limb_t  a)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_sqrtrem2()

static limb_t mp_sqrtrem2 ( limb_t tabs,
limb_t taba 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_sqrtrem_rec()

static int mp_sqrtrem_rec ( bf_context_t s,
limb_t tabs,
limb_t taba,
limb_t  n,
limb_t tmp_buf,
limb_t prh 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_sqrtrem()

int mp_sqrtrem ( bf_context_t s,
limb_t tabs,
limb_t taba,
limb_t  n 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_sqrtrem()

int bf_sqrtrem ( bf_t r,
bf_t rem1,
const bf_t a 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_sqrt()

int bf_sqrt ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_op2()

static no_inline int bf_op2 ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags,
bf_op2_func_t func 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_add()

int bf_add ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_sub()

int bf_sub ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_div()

int bf_div ( bf_t r,
const bf_t a,
const bf_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_mul_ui()

int bf_mul_ui ( bf_t r,
const bf_t a,
uint64_t  b1,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_mul_si()

int bf_mul_si ( bf_t r,
const bf_t a,
int64_t  b1,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_add_si()

int bf_add_si ( bf_t r,
const bf_t a,
int64_t  b1,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_pow_ui()

static int bf_pow_ui ( bf_t r,
const bf_t a,
limb_t  b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_pow_ui_ui()

static int bf_pow_ui_ui ( bf_t r,
limb_t  a1,
limb_t  b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_rint()

int bf_rint ( bf_t r,
int  rnd_mode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_logic_op1()

static limb_t bf_logic_op1 ( limb_t  a,
limb_t  b,
int  op 
)
static
+ Here is the caller graph for this function:

◆ bf_logic_op()

static int bf_logic_op ( bf_t r,
const bf_t a1,
const bf_t b1,
int  op 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_logic_or()

int bf_logic_or ( bf_t r,
const bf_t a,
const bf_t b 
)
+ Here is the call graph for this function:

◆ bf_logic_xor()

int bf_logic_xor ( bf_t r,
const bf_t a,
const bf_t b 
)
+ Here is the call graph for this function:

◆ bf_logic_and()

int bf_logic_and ( bf_t r,
const bf_t a,
const bf_t b 
)
+ Here is the call graph for this function:

◆ bf_get_float64()

int bf_get_float64 ( const bf_t a,
double *  pres,
bf_rnd_t  rnd_mode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_set_float64()

int bf_set_float64 ( bf_t a,
double  d 
)
+ Here is the call graph for this function:

◆ bf_get_int32()

int bf_get_int32 ( int *  pres,
const bf_t a,
int  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_get_int64()

int bf_get_int64 ( int64_t pres,
const bf_t a,
int  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_get_uint64()

int bf_get_uint64 ( uint64_t pres,
const bf_t a 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_limb_radix()

static limb_t get_limb_radix ( int  radix)
static
+ Here is the caller graph for this function:

◆ bf_integer_from_radix_rec()

static int bf_integer_from_radix_rec ( bf_t r,
const limb_t tab,
limb_t  n,
int  level,
limb_t  n0,
limb_t  radix,
bf_t pow_tab 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_integer_from_radix()

static int bf_integer_from_radix ( bf_t r,
const limb_t tab,
limb_t  n,
limb_t  radix 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_mul_pow_radix()

int bf_mul_pow_radix ( bf_t r,
const bf_t T,
limb_t  radix,
slimb_t  expn,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ to_digit()

static int to_digit ( int  c)
static
+ Here is the caller graph for this function:

◆ bf_add_limb()

static int bf_add_limb ( bf_t a,
slimb_t ppos,
limb_t  v 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_tolower()

static int bf_tolower ( int  c)
static
+ Here is the caller graph for this function:

◆ strcasestart()

static int strcasestart ( const char *  str,
const char *  val,
const char **  ptr 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_atof_internal()

static int bf_atof_internal ( bf_t r,
slimb_t pexponent,
const char *  str,
const char **  pnext,
int  radix,
limb_t  prec,
bf_flags_t  flags,
BOOL  is_dec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_atof2()

int bf_atof2 ( bf_t r,
slimb_t pexponent,
const char *  str,
const char **  pnext,
int  radix,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_atof()

int bf_atof ( bf_t r,
const char *  str,
const char **  pnext,
int  radix,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_mul_log2_radix()

slimb_t bf_mul_log2_radix ( slimb_t  a1,
unsigned int  radix,
int  is_inv,
int  is_ceil1 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_integer_to_radix_rec()

static int bf_integer_to_radix_rec ( bf_t pow_tab,
limb_t out,
const bf_t a,
limb_t  n,
int  level,
limb_t  n0,
limb_t  radixl,
unsigned int  radixl_bits 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_integer_to_radix()

static int bf_integer_to_radix ( bf_t r,
const bf_t a,
limb_t  radixl 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_convert_to_radix()

static int bf_convert_to_radix ( bf_t r,
slimb_t pE,
const bf_t a,
int  radix,
limb_t  P,
bf_rnd_t  rnd_mode,
BOOL  is_fixed_exponent 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ limb_to_a()

static void limb_to_a ( char *  buf,
limb_t  n,
unsigned int  radix,
int  len 
)
static
+ Here is the caller graph for this function:

◆ limb_to_a2()

static void limb_to_a2 ( char *  buf,
limb_t  n,
unsigned int  radix_bits,
int  len 
)
static
+ Here is the caller graph for this function:

◆ output_digits()

static void output_digits ( DynBuf s,
const bf_t a1,
int  radix,
limb_t  n_digits,
limb_t  dot_pos,
BOOL  is_dec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_dbuf_realloc()

static void* bf_dbuf_realloc ( void *  opaque,
void *  ptr,
size_t  size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_ftoa_internal()

static char* bf_ftoa_internal ( size_t *  plen,
const bf_t a2,
int  radix,
limb_t  prec,
bf_flags_t  flags,
BOOL  is_dec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_ftoa()

char* bf_ftoa ( size_t *  plen,
const bf_t a,
int  radix,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_log2_rec()

static void bf_const_log2_rec ( bf_t T,
bf_t P,
bf_t Q,
limb_t  n1,
limb_t  n2,
BOOL  need_P 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_log2_internal()

static void bf_const_log2_internal ( bf_t T,
limb_t  prec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ chud_bs()

static void chud_bs ( bf_t P,
bf_t Q,
bf_t G,
int64_t  a,
int64_t  b,
int  need_g,
limb_t  prec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_pi_internal()

static void bf_const_pi_internal ( bf_t Q,
limb_t  prec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_get()

static int bf_const_get ( bf_t T,
limb_t  prec,
bf_flags_t  flags,
BFConstCache c,
void(*)(bf_t *res, limb_t prec)  func,
int  sign 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_free()

static void bf_const_free ( BFConstCache c)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_log2()

int bf_const_log2 ( bf_t T,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_pi_signed()

static int bf_const_pi_signed ( bf_t T,
int  sign,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_const_pi()

int bf_const_pi ( bf_t T,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_clear_cache()

void bf_clear_cache ( bf_context_t s)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_ziv_rounding()

static int bf_ziv_rounding ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags,
ZivFunc f,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_add_epsilon()

static int bf_add_epsilon ( bf_t r,
const bf_t a,
slimb_t  e,
int  e_sign,
limb_t  prec,
int  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_exp_internal()

static int bf_exp_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_exp_underflow_overflow()

static int check_exp_underflow_overflow ( bf_context_t s,
bf_t r,
const bf_t a_low,
const bf_t a_high,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_exp()

int bf_exp ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_log_internal()

static int bf_log_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_log()

int bf_log ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_pow_generic()

static int bf_pow_generic ( bf_t r,
const bf_t x,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_pow_int()

static int bf_pow_int ( bf_t r,
const bf_t x,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_exact_power2n()

static BOOL check_exact_power2n ( bf_t r,
const bf_t x,
slimb_t  n 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_pow()

int bf_pow ( bf_t r,
const bf_t x,
const bf_t y,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_sqrt_sin()

static void bf_sqrt_sin ( bf_t r,
const bf_t x,
limb_t  prec1 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_sincos()

static int bf_sincos ( bf_t s,
bf_t c,
const bf_t a,
limb_t  prec 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_cos_internal()

static int bf_cos_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_cos()

int bf_cos ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_sin_internal()

static int bf_sin_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_sin()

int bf_sin ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_tan_internal()

static int bf_tan_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_tan()

int bf_tan ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_atan_internal()

static int bf_atan_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_atan()

int bf_atan ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_atan2_internal()

static int bf_atan2_internal ( bf_t r,
const bf_t y,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_atan2()

int bf_atan2 ( bf_t r,
const bf_t y,
const bf_t x,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_asin_internal()

static int bf_asin_internal ( bf_t r,
const bf_t a,
limb_t  prec,
void *  opaque 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_asin()

int bf_asin ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bf_acos()

int bf_acos ( bf_t r,
const bf_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ shrd()

static __maybe_unused limb_t shrd ( limb_t  low,
limb_t  high,
long  shift 
)
static

◆ shld()

static __maybe_unused limb_t shld ( limb_t  a1,
limb_t  a0,
long  shift 
)
static

◆ fast_udiv_init()

static __maybe_unused void fast_udiv_init ( FastDivData s,
limb_t  d 
)
static
+ Here is the call graph for this function:

◆ fast_udiv()

static limb_t fast_udiv ( limb_t  a,
const FastDivData s 
)
static
+ Here is the caller graph for this function:

◆ fast_shr_dec()

static limb_t fast_shr_dec ( limb_t  a,
int  shift 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_add_dec()

limb_t mp_add_dec ( limb_t res,
const limb_t op1,
const limb_t op2,
mp_size_t  n,
limb_t  carry 
)
+ Here is the caller graph for this function:

◆ mp_add_ui_dec()

limb_t mp_add_ui_dec ( limb_t tab,
limb_t  b,
mp_size_t  n 
)
+ Here is the caller graph for this function:

◆ mp_sub_dec()

limb_t mp_sub_dec ( limb_t res,
const limb_t op1,
const limb_t op2,
mp_size_t  n,
limb_t  carry 
)
+ Here is the caller graph for this function:

◆ mp_sub_ui_dec()

limb_t mp_sub_ui_dec ( limb_t tab,
limb_t  b,
mp_size_t  n 
)
+ Here is the caller graph for this function:

◆ mp_mul1_dec()

limb_t mp_mul1_dec ( limb_t tabr,
const limb_t taba,
mp_size_t  n,
limb_t  b,
limb_t  l 
)
+ Here is the caller graph for this function:

◆ mp_add_mul1_dec()

limb_t mp_add_mul1_dec ( limb_t tabr,
const limb_t taba,
mp_size_t  n,
limb_t  b 
)
+ Here is the caller graph for this function:

◆ mp_sub_mul1_dec()

limb_t mp_sub_mul1_dec ( limb_t tabr,
const limb_t taba,
mp_size_t  n,
limb_t  b 
)
+ Here is the caller graph for this function:

◆ mp_mul_basecase_dec()

void mp_mul_basecase_dec ( limb_t result,
const limb_t op1,
mp_size_t  op1_size,
const limb_t op2,
mp_size_t  op2_size 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_div1_dec()

limb_t mp_div1_dec ( limb_t tabr,
const limb_t taba,
mp_size_t  na,
limb_t  b,
limb_t  r 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_print_str_dec()

static __maybe_unused void mp_print_str_dec ( const char *  str,
const limb_t tab,
slimb_t  n 
)
static
+ Here is the caller graph for this function:

◆ mp_print_str_h_dec()

static __maybe_unused void mp_print_str_h_dec ( const char *  str,
const limb_t tab,
slimb_t  n,
limb_t  high 
)
static
+ Here is the caller graph for this function:

◆ mp_div_dec()

static int mp_div_dec ( bf_context_t s,
limb_t tabq,
limb_t taba,
mp_size_t  na,
const limb_t tabb1,
mp_size_t  nb 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_shr_dec()

static limb_t mp_shr_dec ( limb_t tab_r,
const limb_t tab,
mp_size_t  n,
limb_t  shift,
limb_t  high 
)
static
+ Here is the caller graph for this function:

◆ mp_shl_dec()

static limb_t mp_shl_dec ( limb_t tab_r,
const limb_t tab,
mp_size_t  n,
limb_t  shift,
limb_t  low 
)
static
+ Here is the caller graph for this function:

◆ mp_sqrtrem2_dec()

static limb_t mp_sqrtrem2_dec ( limb_t tabs,
limb_t taba 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_sqrtrem_rec_dec()

static limb_t mp_sqrtrem_rec_dec ( limb_t tabs,
limb_t taba,
limb_t  n,
limb_t tmp_buf 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mp_sqrtrem_dec()

int mp_sqrtrem_dec ( bf_context_t s,
limb_t tabs,
limb_t taba,
limb_t  n 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clz_dec()

static int clz_dec ( limb_t  a)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_print_str()

void bfdec_print_str ( const char *  str,
const bfdec_t a 
)

◆ scan_digit_nz()

static limb_t scan_digit_nz ( const bfdec_t r,
slimb_t  bit_pos 
)
static
+ Here is the caller graph for this function:

◆ bfdec_get_rnd_add()

static int bfdec_get_rnd_add ( int *  pret,
const bfdec_t r,
limb_t  l,
slimb_t  prec,
int  rnd_mode 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bfdec_round()

static int __bfdec_round ( bfdec_t r,
limb_t  prec1,
bf_flags_t  flags,
limb_t  l 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_round()

int bfdec_round ( bfdec_t r,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_normalize_and_round()

int bfdec_normalize_and_round ( bfdec_t r,
limb_t  prec1,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_set_ui()

int bfdec_set_ui ( bfdec_t r,
uint64_t  v 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_set_si()

int bfdec_set_si ( bfdec_t r,
int64_t  v 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_add_internal()

static int bfdec_add_internal ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags,
int  b_neg 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bfdec_add()

static int __bfdec_add ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bfdec_sub()

static int __bfdec_sub ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_add()

int bfdec_add ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_sub()

int bfdec_sub ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_mul()

int bfdec_mul ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_mul_si()

int bfdec_mul_si ( bfdec_t r,
const bfdec_t a,
int64_t  b1,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_add_si()

int bfdec_add_si ( bfdec_t r,
const bfdec_t a,
int64_t  b1,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __bfdec_div()

static int __bfdec_div ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_div()

int bfdec_div ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_tdivremu()

static void bfdec_tdivremu ( bf_context_t s,
bfdec_t q,
bfdec_t r,
const bfdec_t a,
const bfdec_t b 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_divrem()

int bfdec_divrem ( bfdec_t q,
bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags,
int  rnd_mode 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_rem()

int bfdec_rem ( bfdec_t r,
const bfdec_t a,
const bfdec_t b,
limb_t  prec,
bf_flags_t  flags,
int  rnd_mode 
)
+ Here is the call graph for this function:

◆ bfdec_rint()

int bfdec_rint ( bfdec_t r,
int  rnd_mode 
)
+ Here is the call graph for this function:

◆ bfdec_sqrt()

int bfdec_sqrt ( bfdec_t r,
const bfdec_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ bfdec_get_int32()

int bfdec_get_int32 ( int *  pres,
const bfdec_t a 
)
+ Here is the call graph for this function:

◆ bfdec_pow_ui()

int bfdec_pow_ui ( bfdec_t r,
const bfdec_t a,
limb_t  b 
)
+ Here is the call graph for this function:

◆ bfdec_ftoa()

char* bfdec_ftoa ( size_t *  plen,
const bfdec_t a,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bfdec_atof()

int bfdec_atof ( bfdec_t r,
const char *  str,
const char **  pnext,
limb_t  prec,
bf_flags_t  flags 
)
+ Here is the call graph for this function:

◆ put_bits()

static void put_bits ( limb_t tab,
limb_t  len,
slimb_t  pos,
limb_t  val 
)
static
+ Here is the caller graph for this function:

◆ get_trig()

static no_inline NTTLimb * get_trig ( BFNTTState s,
int  k,
int  inverse,
int  m_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_mod()

static limb_t add_mod ( limb_t  a,
limb_t  b,
limb_t  m 
)
static
+ Here is the caller graph for this function:

◆ sub_mod()

static limb_t sub_mod ( limb_t  a,
limb_t  b,
limb_t  m 
)
static
+ Here is the caller graph for this function:

◆ mod_fast()

static limb_t mod_fast ( dlimb_t  r,
limb_t  m,
limb_t  m_inv 
)
static
+ Here is the caller graph for this function:

◆ mul_mod_fast()

static limb_t mul_mod_fast ( limb_t  a,
limb_t  b,
limb_t  m,
limb_t  m_inv 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_mul_mod_fast()

static limb_t init_mul_mod_fast ( limb_t  m)
static
+ Here is the caller graph for this function:

◆ mul_mod_fast2()

static limb_t mul_mod_fast2 ( limb_t  a,
limb_t  b,
limb_t  m,
limb_t  b_inv 
)
static
+ Here is the caller graph for this function:

◆ mul_mod_fast3()

static limb_t mul_mod_fast3 ( limb_t  a,
limb_t  b,
limb_t  m,
limb_t  b_inv 
)
static
+ Here is the caller graph for this function:

◆ init_mul_mod_fast2()

static limb_t init_mul_mod_fast2 ( limb_t  b,
limb_t  m 
)
static
+ Here is the caller graph for this function:

◆ ntt_malloc()

static void* ntt_malloc ( BFNTTState s,
size_t  size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_free()

static void ntt_free ( BFNTTState s,
void *  ptr 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_limb_to_int()

static limb_t ntt_limb_to_int ( NTTLimb  a,
limb_t  m 
)
static
+ Here is the caller graph for this function:

◆ int_to_ntt_limb()

static NTTLimb int_to_ntt_limb ( slimb_t  a,
limb_t  m 
)
static
+ Here is the caller graph for this function:

◆ ntt_fft()

static no_inline int ntt_fft ( BFNTTState s,
NTTLimb out_buf,
NTTLimb in_buf,
NTTLimb tmp_buf,
int  fft_len_log2,
int  inverse,
int  m_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_vec_mul()

static void ntt_vec_mul ( BFNTTState s,
NTTLimb tab1,
NTTLimb tab2,
int  fft_len_log2,
int  k_tot,
int  m_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mul_trig()

static no_inline void mul_trig ( NTTLimb buf,
limb_t  n,
limb_t  c_mul,
limb_t  m,
limb_t  m_inv 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_fft_partial()

static int ntt_fft_partial ( BFNTTState s,
NTTLimb buf1,
int  k1,
int  k2,
limb_t  n1,
limb_t  n2,
int  inverse,
limb_t  m_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_conv()

static int ntt_conv ( BFNTTState s,
NTTLimb buf1,
NTTLimb buf2,
int  k,
int  k_tot,
limb_t  m_idx 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ limb_to_ntt()

static no_inline void limb_to_ntt ( BFNTTState s,
NTTLimb tabr,
limb_t  fft_len,
const limb_t taba,
limb_t  a_len,
int  dpl,
int  first_m_idx,
int  nb_mods 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_to_limb()

static no_inline void ntt_to_limb ( BFNTTState s,
limb_t tabr,
limb_t  r_len,
const NTTLimb buf,
int  fft_len_log2,
int  dpl,
int  nb_mods 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ntt_static_init()

static int ntt_static_init ( bf_context_t s1)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bf_get_fft_size()

int bf_get_fft_size ( int *  pdpl,
int *  pnb_mods,
limb_t  len 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ sqrt_table

const uint16_t sqrt_table[192]
static
Initial value:
= {
128,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,150,151,152,153,154,155,155,156,157,158,159,160,160,161,162,163,163,164,165,166,167,167,168,169,170,170,171,172,173,173,174,175,176,176,177,178,178,179,180,181,181,182,183,183,184,185,185,186,187,187,188,189,189,190,191,192,192,193,193,194,195,195,196,197,197,198,199,199,200,201,201,202,203,203,204,204,205,206,206,207,208,208,209,209,210,211,211,212,212,213,214,214,215,215,216,217,217,218,218,219,219,220,221,221,222,222,223,224,224,225,225,226,226,227,227,228,229,229,230,230,231,231,232,232,233,234,234,235,235,236,236,237,237,238,238,239,240,240,241,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,
}

◆ digits_per_limb_table

const uint8_t digits_per_limb_table[BF_RADIX_MAX - 1]
static
Initial value:
= {
64,40,32,27,24,22,21,20,19,18,17,17,16,16,16,15,15,15,14,14,14,14,13,13,13,13,13,13,13,12,12,12,12,12,12,
}

◆ inv_log2_radix

const uint32_t inv_log2_radix[BF_RADIX_MAX - 1][LIMB_BITS/32+1]
static

◆ log2_radix

const limb_t log2_radix[BF_RADIX_MAX - 1]
static

◆ mp_pow_dec

const limb_t mp_pow_dec[LIMB_DIGITS+1]
Initial value:
= {
1U,
10U,
100U,
1000U,
10000U,
100000U,
1000000U,
10000000U,
100000000U,
1000000000U,
10000000000U,
100000000000U,
1000000000000U,
10000000000000U,
100000000000000U,
1000000000000000U,
10000000000000000U,
100000000000000000U,
1000000000000000000U,
10000000000000000000U,
}

◆ mp_pow_div

const FastDivData mp_pow_div[LIMB_DIGITS+1]
static

◆ ntt_int_bits

const int ntt_int_bits[NB_MODS] = { 307, 246, 185, 123, 61, }
static

◆ ntt_mods

const limb_t ntt_mods[NB_MODS]
static
Initial value:
= { 0x28d8000000000001, 0x2a88000000000001, 0x2ed8000000000001, 0x3508000000000001, 0x3aa8000000000001,
}

◆ ntt_proot

const limb_t ntt_proot[2][NB_MODS]
static
Initial value:
= {
{ 0x1b8ea61034a2bea7, 0x21a9762de58206fb, 0x02ca782f0756a8ea, 0x278384537a3e50a1, 0x106e13fee74ce0ab, },
{ 0x233513af133e13b8, 0x1d13140d1c6f75f1, 0x12cde57f97e3eeda, 0x0d6149e23cbe654f, 0x36cd204f522a1379, },
}

◆ ntt_mods_cr

const limb_t ntt_mods_cr[NB_MODS *(NB_MODS - 1)/2]
static
Initial value:
= {
0x08a9ed097b425eea, 0x18a44aaaaaaaaab3, 0x2493f57f57f57f5d, 0x126b8d0649a7f8d4,
0x09d80ed7303b5ccc, 0x25b8bcf3cf3cf3d5, 0x2ce6ce63398ce638,
0x0e31fad40a57eb59, 0x02a3529fd4a7f52f,
0x3a5493e93e93e94a,
}