Ruby 2.1.5p273(2014-11-13revision48405)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
bignum.c File Reference
`#include "ruby/ruby.h"`
`#include "ruby/thread.h"`
`#include "ruby/util.h"`
`#include "internal.h"`
`#include <math.h>`
`#include <float.h>`
`#include <ctype.h>`
`#include <assert.h>`
Include dependency graph for bignum.c:

Go to the source code of this file.

## Data Structures
struct | big_div_struct
struct | big2str_struct

## Macros
#define | RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
#define | SIZEOF_BDIGIT_DBL SIZEOF_LONG_LONG
#define | HOST_BIGENDIAN_P 0
#define | ALIGNOF(type) ((int)offsetof(struct { char f1; type f2; }, f2))
#define | LSHIFTABLE(d, n) ((n) < sizeof(d) * CHAR_BIT)
#define | LSHIFTX(d, n) (!LSHIFTABLE(d, n) ? 0 : ((d) << (!LSHIFTABLE(d, n) ? 0 : (n))))
#define | CLEAR_LOWBITS(d, numbits) ((d) & LSHIFTX(~((d)*0), (numbits)))
#define | FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))
#define | POW2_P(x) (((x)&((x)-1))==0)
#define | BDIGITS(x) (RBIGNUM_DIGITS(x))
#define | BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
#define | BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)
#define | BIGRAD_HALF ((BDIGIT)(BIGRAD >> 1))
#define | BDIGIT_MSB(d) (((d) & BIGRAD_HALF) != 0)
#define | BIGUP(x) LSHIFTX(((x) + (BDIGIT_DBL)0), BITSPERDIG)
#define | BIGDN(x) RSHIFT((x),BITSPERDIG)
#define | BIGLO(x) ((BDIGIT)((x) & BDIGMAX))
#define | BDIGMAX ((BDIGIT)(BIGRAD-1))
#define | BDIGIT_DBL_MAX (~(BDIGIT_DBL)0)
#define | BIGZEROP(x)
#define | BIGSIZE(x)
#define | BIGDIVREM_EXTRA_WORDS 1
#define | roomof(n, m) ((long)(((n)+(m)-1) / (m)))
#define | bdigit_roomof(n) roomof(n, SIZEOF_BDIGITS)
#define | BARY_ARGS(ary) ary, numberof(ary)
#define | BARY_ADD(z, x, y) bary_add(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
#define | BARY_SUB(z, x, y) bary_sub(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
#define | BARY_SHORT_MUL(z, x, y) bary_short_mul(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
#define | BARY_DIVMOD(q, r, x, y) bary_divmod(BARY_ARGS(q), BARY_ARGS(r), BARY_ARGS(x), BARY_ARGS(y))
#define | BARY_ZERO_P(x) bary_zero_p(BARY_ARGS(x))
#define | RBIGNUM_SET_NEGATIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 0)
#define | RBIGNUM_SET_POSITIVE_SIGN(b) RBIGNUM_SET_SIGN(b, 1)
#define | bignew(len, sign) bignew_1(rb_cBignum,(len),(sign))
#define | BDIGITS_ZERO(ptr, n)
#define | BARY_TRUNC(ds, n)
#define | KARATSUBA_BALANCED(xn, yn) ((yn)/2 < (xn))
#define | TOOM3_BALANCED(xn, yn) (((yn)+2)/3 * 2 < (xn))
#define | GMP_MUL_DIGITS 20
#define | KARATSUBA_MUL_DIGITS 70
#define | TOOM3_MUL_DIGITS 150
#define | GMP_DIV_DIGITS 20
#define | GMP_BIG2STR_DIGITS 20
#define | GMP_STR2BIG_DIGITS 20
#define | U16(a) ((uint16_t)(a))
#define | U32(a) ((uint32_t)(a))
#define | INTEGER_PACK_WORDORDER_MASK
#define | INTEGER_PACK_BYTEORDER_MASK
#define | FILL_DD integer_pack_fill_dd(&dp, &de, &dd, &numbits_in_dd)
#define | TAKE_LOWBITS(n) integer_pack_take_lowbits(n, &dd, &numbits_in_dd)
#define | PUSH_BITS(data, numbits) integer_unpack_push_bits(data, numbits, &dd, &numbits_in_dd, &dp)
#define | BIGNUM_DEBUG 0
#define | ON_DEBUG(x)
#define | RBIGNUM_SET_LEN(b, l)
#define | QUAD_SIZE 8
#define | conv_digit(c) (ruby_digit36_to_number_table[(unsigned char)(c)])
#define | MAX_BASE36_POWER_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)
#define | DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)

## Typedefs
typedef void( | mulfunc_t )(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)

## Enumerations
enum | big_op_t { big_op_gt, big_op_ge, big_op_lt, big_op_le }

## Functions
| STATIC_ASSERT (sizeof_bdigit_dbl, sizeof(BDIGIT_DBL)==SIZEOF_BDIGIT_DBL)
| STATIC_ASSERT (sizeof_bdigit_dbl_signed, sizeof(BDIGIT_DBL_SIGNED)==SIZEOF_BDIGIT_DBL)
| STATIC_ASSERT (sizeof_bdigit, SIZEOF_BDIGITS<=sizeof(BDIGIT))
| STATIC_ASSERT (sizeof_bdigit_and_dbl, SIZEOF_BDIGITS *2<=SIZEOF_BDIGIT_DBL)
| STATIC_ASSERT (bdigit_signedness, 0< (BDIGIT)-1)
| STATIC_ASSERT (bdigit_dbl_signedness, 0< (BDIGIT_DBL)-1)
| STATIC_ASSERT (bdigit_dbl_signed_signedness, 0 >(BDIGIT_DBL_SIGNED)-1)
| STATIC_ASSERT (rbignum_embed_len_max, RBIGNUM_EMBED_LEN_MAX<=(RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT))
| STATIC_ASSERT (sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGITS%SIZEOF_LONG==0)
static BDIGIT | bigdivrem_single (BDIGIT *qds, const BDIGIT *xds, size_t xn, BDIGIT y)
static void | bary_divmod (BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static VALUE | bigmul0 (VALUE x, VALUE y)
static void | bary_mul_toom3 (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
static VALUE | bignew_1 (VALUE klass, long len, int sign)
static VALUE | bigtrunc (VALUE x)
static VALUE | bigsq (VALUE x)
static void | bigdivmod (VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
static VALUE | power_cache_get_power (int base, int power_level, size_t *numdigits_ret)
static int | nlz (BDIGIT x)
static BDIGIT_DBL | maxpow_in_bdigit_dbl (int base, int *exp_ret)
static BDIGIT_DBL | bary2bdigitdbl (const BDIGIT *ds, size_t n)
static void | bdigitdbl2bary (BDIGIT *ds, size_t n, BDIGIT_DBL num)
static int | bary_cmp (const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static BDIGIT | bary_small_lshift (BDIGIT *zds, const BDIGIT *xds, size_t n, int shift)
static void | bary_small_rshift (BDIGIT *zds, const BDIGIT *xds, size_t n, int shift, BDIGIT higher_bdigit)
static int | bary_zero_p (BDIGIT *xds, size_t xn)
static void | bary_neg (BDIGIT *ds, size_t n)
static int | bary_2comp (BDIGIT *ds, size_t n)
static void | bary_swap (BDIGIT *ds, size_t num_bdigits)
static void | validate_integer_pack_format (size_t numwords, size_t wordsize, size_t nails, int flags, int supported_flags)
static void | integer_pack_loop_setup (size_t numwords, size_t wordsize, size_t nails, int flags, size_t *word_num_fullbytes_ret, int *word_num_partialbits_ret, size_t *word_start_ret, ssize_t *word_step_ret, size_t *word_last_ret, size_t *byte_start_ret, int *byte_step_ret)
static void | integer_pack_fill_dd (BDIGIT **dpp, BDIGIT **dep, BDIGIT_DBL *ddp, int *numbits_in_dd_p)
static BDIGIT_DBL | integer_pack_take_lowbits (int n, BDIGIT_DBL *ddp, int *numbits_in_dd_p)
static int | bytes_2comp (unsigned char *buf, size_t len)
static int | bary_pack (int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
static size_t | integer_unpack_num_bdigits_small (size_t numwords, size_t wordsize, size_t nails, int *nlp_bits_ret)
static size_t | integer_unpack_num_bdigits_generic (size_t numwords, size_t wordsize, size_t nails, int *nlp_bits_ret)
static size_t | integer_unpack_num_bdigits (size_t numwords, size_t wordsize, size_t nails, int *nlp_bits_ret)
static void | integer_unpack_push_bits (int data, int numbits, BDIGIT_DBL *ddp, int *numbits_in_dd_p, BDIGIT **dpp)
static int | integer_unpack_single_bdigit (BDIGIT u, size_t size, int flags, BDIGIT *dp)
static int | bary_unpack_internal (BDIGIT *bdigits, size_t num_bdigits, const void *words, size_t numwords, size_t wordsize, size_t nails, int flags, int nlp_bits)
static void | bary_unpack (BDIGIT *bdigits, size_t num_bdigits, const void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
static int | bary_subb (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, int borrow)
static int | bary_sub (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static int | bary_sub_one (BDIGIT *zds, size_t zn)
static int | bary_addc (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, int carry)
static int | bary_add (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static int | bary_add_one (BDIGIT *ds, size_t n)
static void | bary_mul_single (BDIGIT *zds, size_t zn, BDIGIT x, BDIGIT y)
static int | bary_muladd_1xN (BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
static BDIGIT_DBL_SIGNED | bigdivrem_mulsub (BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
static int | bary_mulsub_1xN (BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
static void | bary_mul_normal (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
VALUE | rb_big_mul_normal (VALUE x, VALUE y)
static void | bary_sq_fast (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn)
VALUE | rb_big_sq_fast (VALUE x)
static void | bary_mul_balance_with_mulfunc (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn, mulfunc_t *mulfunc)
VALUE | rb_big_mul_balance (VALUE x, VALUE y)
static void | bary_mul_karatsuba (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
VALUE | rb_big_mul_karatsuba (VALUE x, VALUE y)
VALUE | rb_big_mul_toom3 (VALUE x, VALUE y)
static void | bary_short_mul (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static int | bary_sparse_p (const BDIGIT *ds, size_t n)
static int | bary_mul_precheck (BDIGIT **zdsp, size_t *znp, const BDIGIT **xdsp, size_t *xnp, const BDIGIT **ydsp, size_t *ynp)
static void | bary_mul_karatsuba_branch (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
static void | bary_mul_karatsuba_start (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
static void | bary_mul_toom3_branch (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
static void | bary_mul_toom3_start (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
static void | bary_mul (BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static void * | bigdivrem1 (void *ptr)
static void | rb_big_stop (void *ptr)
static BDIGIT | bigdivrem_single1 (BDIGIT *qds, const BDIGIT *xds, size_t xn, BDIGIT x_higher_bdigit, BDIGIT y)
static void | bigdivrem_restoring (BDIGIT *zds, size_t zn, BDIGIT *yds, size_t yn)
static void | bary_divmod_normal (BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
VALUE | rb_big_divrem_normal (VALUE x, VALUE y)
static void | bary_divmod_branch (BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
static int | bigzero_p (VALUE x)
int | rb_bigzero_p (VALUE x)
int | rb_cmpint (VALUE val, VALUE a, VALUE b)
static void | rb_big_realloc (VALUE big, long len)
void | rb_big_resize (VALUE big, long len)
VALUE | rb_big_new (long len, int sign)
VALUE | rb_big_clone (VALUE x)
static void | big_extend_carry (VALUE x)
static void | get2comp (VALUE x)
void | rb_big_2comp (VALUE x)
static BDIGIT | abs2twocomp (VALUE *xp, long *n_ret)
static void | twocomp2abs_bang (VALUE x, int hibits)
static VALUE | bigfixize (VALUE x)
static VALUE | bignorm (VALUE x)
VALUE | rb_big_norm (VALUE x)
VALUE | rb_uint2big (VALUE n)
VALUE | rb_int2big (SIGNED_VALUE n)
VALUE | rb_uint2inum (VALUE n)
VALUE | rb_int2inum (SIGNED_VALUE n)
void | rb_big_pack (VALUE val, unsigned long *buf, long num_longs)
VALUE | rb_big_unpack (unsigned long *buf, long num_longs)
size_t | rb_absint_size (VALUE val, int *nlz_bits_ret)
static size_t | absint_numwords_small (size_t numbytes, int nlz_bits_in_msbyte, size_t word_numbits, size_t *nlz_bits_ret)
static size_t | absint_numwords_generic (size_t numbytes, int nlz_bits_in_msbyte, size_t word_numbits, size_t *nlz_bits_ret)
size_t | rb_absint_numwords (VALUE val, size_t word_numbits, size_t *nlz_bits_ret)
int | rb_absint_singlebit_p (VALUE val)
int | rb_integer_pack (VALUE val, void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
VALUE | rb_integer_unpack (const void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
void | rb_quad_pack (char *buf, VALUE val)
VALUE | rb_quad_unpack (const char *buf, int signed_p)
static void | str2big_scan_digits (const char *s, const char *str, int base, int badcheck, size_t *num_digits_p, size_t *len_p)
static VALUE | str2big_poweroftwo (int sign, const char *digits_start, const char *digits_end, size_t num_digits, int bits_per_digit)
static VALUE | str2big_normal (int sign, const char *digits_start, const char *digits_end, size_t num_bdigits, int base)
static VALUE | str2big_karatsuba (int sign, const char *digits_start, const char *digits_end, size_t num_digits, size_t num_bdigits, int digits_per_bdigits_dbl, int base)
VALUE | rb_cstr_to_inum (const char *str, int base, int badcheck)
VALUE | rb_str_to_inum (VALUE str, int base, int badcheck)
VALUE | rb_str2big_poweroftwo (VALUE arg, int base, int badcheck)
VALUE | rb_str2big_normal (VALUE arg, int base, int badcheck)
VALUE | rb_str2big_karatsuba (VALUE arg, int base, int badcheck)
VALUE | rb_cstr2inum (const char *str, int base)
VALUE | rb_str2inum (VALUE str, int base)
static VALUE | big_shift3 (VALUE x, int lshift_p, size_t shift_numdigits, int shift_numbits)
static VALUE | big_shift2 (VALUE x, int lshift_p, VALUE y)
static VALUE | big_lshift (VALUE x, unsigned long shift)
static VALUE | big_rshift (VALUE x, unsigned long shift)
static void | power_cache_init (void)
static long | big2str_find_n1 (VALUE x, int base)
static void | big2str_alloc (struct big2str_struct *b2s, size_t len)
static void | big2str_2bdigits (struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t taillen)
static void | big2str_karatsuba (struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t wn, int power_level, size_t taillen)
static VALUE | big2str_base_poweroftwo (VALUE x, int base)
VALUE | rb_big2str_poweroftwo (VALUE x, int base)
static VALUE | big2str_generic (VALUE x, int base)
VALUE | rb_big2str_generic (VALUE x, int base)
static VALUE | rb_big2str1 (VALUE x, int base)
VALUE | rb_big2str0 (VALUE x, int base, int trim)
VALUE | rb_big2str (VALUE x, int base)
static VALUE | rb_big_to_s (int argc, VALUE *argv, VALUE x)
static unsigned long | big2ulong (VALUE x, const char *type)
VALUE | rb_big2ulong_pack (VALUE x)
VALUE | rb_big2ulong (VALUE x)
SIGNED_VALUE | rb_big2long (VALUE x)
static VALUE | dbl2big (double d)
VALUE | rb_dbl2big (double d)
static double | big2dbl (VALUE x)
double | rb_big2dbl (VALUE x)
static VALUE | rb_big_to_f (VALUE x)
VALUE | rb_integer_float_cmp (VALUE x, VALUE y)
VALUE | rb_integer_float_eq (VALUE x, VALUE y)
VALUE | rb_big_cmp (VALUE x, VALUE y)
static VALUE | big_op (VALUE x, VALUE y, enum big_op_t op)
static VALUE | big_gt (VALUE x, VALUE y)
static VALUE | big_ge (VALUE x, VALUE y)
static VALUE | big_lt (VALUE x, VALUE y)
static VALUE | big_le (VALUE x, VALUE y)
VALUE | rb_big_eq (VALUE x, VALUE y)
VALUE | rb_big_eql (VALUE x, VALUE y)
VALUE | rb_big_uminus (VALUE x)
static VALUE | rb_big_neg (VALUE x)
static VALUE | bigsub (VALUE x, VALUE y)
static VALUE | bigadd_int (VALUE x, long y)
static VALUE | bigsub_int (VALUE x, long y0)
static VALUE | bigadd (VALUE x, VALUE y, int sign)
VALUE | rb_big_plus (VALUE x, VALUE y)
VALUE | rb_big_minus (VALUE x, VALUE y)
VALUE | rb_big_mul (VALUE x, VALUE y)
static VALUE | bigdivrem (VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
static VALUE | rb_big_divide (VALUE x, VALUE y, ID op)
VALUE | rb_big_div (VALUE x, VALUE y)
VALUE | rb_big_idiv (VALUE x, VALUE y)
VALUE | rb_big_modulo (VALUE x, VALUE y)
static VALUE | rb_big_remainder (VALUE x, VALUE y)
VALUE | rb_big_divmod (VALUE x, VALUE y)
static VALUE | big_shift (VALUE x, long n)
static VALUE | big_fdiv (VALUE x, VALUE y, long ey)
static VALUE | big_fdiv_int (VALUE x, VALUE y)
static VALUE | big_fdiv_float (VALUE x, VALUE y)
VALUE | rb_big_fdiv (VALUE x, VALUE y)
VALUE | rb_big_pow (VALUE x, VALUE y)
static VALUE | bigand_int (VALUE x, long xn, BDIGIT hibitsx, long y)
VALUE | rb_big_and (VALUE x, VALUE y)
static VALUE | bigor_int (VALUE x, long xn, BDIGIT hibitsx, long y)
VALUE | rb_big_or (VALUE x, VALUE y)
static VALUE | bigxor_int (VALUE x, long xn, BDIGIT hibitsx, long y)
VALUE | rb_big_xor (VALUE x, VALUE y)
VALUE | rb_big_lshift (VALUE x, VALUE y)
VALUE | rb_big_rshift (VALUE x, VALUE y)
static VALUE | rb_big_aref (VALUE x, VALUE y)
static VALUE | rb_big_hash (VALUE x)
static VALUE | rb_big_coerce (VALUE x, VALUE y)
static VALUE | rb_big_abs (VALUE x)
static VALUE | rb_big_size (VALUE big)
static VALUE | rb_big_bit_length (VALUE big)
static VALUE | rb_big_odd_p (VALUE num)
static VALUE | rb_big_even_p (VALUE num)
void | Init_Bignum (void)

## Variables
VALUE | rb_cBignum
const char | ruby_digitmap [] = "0123456789abcdefghijklmnopqrstuvwxyz"
static mulfunc_t | bary_mul_toom3_start
static mulfunc_t | bary_mul_karatsuba_start
static VALUE | base36_power_cache [35][MAX_BASE36_POWER_TABLE_ENTRIES]
static size_t | base36_numdigits_cache [35][MAX_BASE36_POWER_TABLE_ENTRIES]

## Macro Definition Documentation

#define ALIGNOF | ( |  | type | ) | ((int)offsetof(struct { char f1; type f2; }, f2))

Definition at line 66 of file bignum.c.

Referenced by bary_pack(), and bary_unpack_internal().

#define BARY_ADD | ( |  | z,
|  |  | x,
|  |  | y
| ) |  | bary_add(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))

Definition at line 106 of file bignum.c.

Referenced by absint_numwords_generic().

#define BARY_ARGS | ( |  | ary | ) | ary, numberof(ary)

Definition at line 104 of file bignum.c.

Referenced by absint_numwords_generic(), and rb_big_bit_length().

#define BARY_DIVMOD | ( |  | q,
|  |  | r,
|  |  | x,
|  |  | y
| ) |  | bary_divmod(BARY_ARGS(q), BARY_ARGS(r), BARY_ARGS(x), BARY_ARGS(y))

Definition at line 109 of file bignum.c.

Referenced by absint_numwords_generic().

#define BARY_SHORT_MUL | ( |  | z,
|  |  | x,
|  |  | y
| ) |  | bary_short_mul(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))

Definition at line 108 of file bignum.c.

Referenced by absint_numwords_generic(), and rb_big_bit_length().

#define BARY_SUB | ( |  | z,
|  |  | x,
|  |  | y
| ) |  | bary_sub(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))

Definition at line 107 of file bignum.c.

Referenced by absint_numwords_generic(), and rb_big_bit_length().

#define BARY_TRUNC | ( |  | ds,
|  |  | n
| ) |  |

Value:
do { \
while (0 < (n) && (ds)[(n)-1] == 0) \
(n)--; \
} while (0)

Definition at line 126 of file bignum.c.

Referenced by abs2twocomp(), bary_cmp(), bary_divmod(), bary_mul_toom3(), big2str_generic(), big2str_karatsuba(), bigdivrem(), bigfixize(), rb_big2str1(), rb_big_divrem_normal(), and str2big_karatsuba().

#define BARY_ZERO_P | ( |  | x | ) | bary_zero_p(BARY_ARGS(x))

Definition at line 110 of file bignum.c.

Referenced by absint_numwords_generic().

#define BDIGIT_DBL_MAX (~(BDIGIT_DBL)0)

Definition at line 83 of file bignum.c.

Referenced by maxpow_in_bdigit_dbl().

#define BDIGIT_MSB | ( |  | d | ) | (((d) & BIGRAD_HALF) != 0)

Definition at line 78 of file bignum.c.

Referenced by bary_unpack_internal(), bigdivrem_restoring(), and rb_integer_unpack().

#define bdigit_roomof | ( |  | n | ) | roomof(n, SIZEOF_BDIGITS)

Definition at line 103 of file bignum.c.

Referenced by absint_numwords_generic(), bigadd_int(), bigand_int(), bigdivrem(), bigor_int(), bigsub_int(), bigxor_int(), rb_absint_singlebit_p(), rb_absint_size(), rb_big_bit_length(), rb_integer_pack(), and rb_uint2big().

#define BDIGITS | ( |  | x | ) | (RBIGNUM_DIGITS(x))

Definition at line 74 of file bignum.c.

Referenced by abs2twocomp(), big2dbl(), big2str_generic(), big2str_karatsuba(), big2ulong(), big_extend_carry(), big_fdiv(), big_fdiv_int(), big_shift3(), bigadd(), bigadd_int(), bigand_int(), bigdivrem(), bigfixize(), bigmul0(), bigor_int(), bigsq(), bigsub(), bigsub_int(), bigtrunc(), bigxor_int(), bigzero_p(), dbl2big(), get2comp(), power_cache_get_power(), rb_absint_singlebit_p(), rb_absint_size(), rb_big2str1(), rb_big_and(), rb_big_aref(), rb_big_clone(), rb_big_cmp(), rb_big_divrem_normal(), rb_big_eq(), rb_big_eql(), rb_big_even_p(), rb_big_hash(), rb_big_mul_balance(), rb_big_mul_karatsuba(), rb_big_mul_normal(), rb_big_mul_toom3(), rb_big_neg(), rb_big_odd_p(), rb_big_or(), rb_big_sq_fast(), rb_big_xor(), rb_integer_pack(), rb_integer_unpack(), rb_uint2big(), str2big_karatsuba(), str2big_normal(), and str2big_poweroftwo().

#define BDIGITS_ZERO | ( |  | ptr,
|  |  | n
| ) |  |

Value:
do { \
BDIGIT *bdigitz_zero_ptr = (ptr); \
size_t bdigitz_zero_n = (n); \
while (bdigitz_zero_n) { \
*bdigitz_zero_ptr++ = 0; \
bdigitz_zero_n--; \
} \
} while (0)
BDIGIT
#define BDIGIT
Definition: bigdecimal.h:47

Definition at line 117 of file bignum.c.

Referenced by bary_divmod(), bary_divmod_normal(), bary_mul_balance_with_mulfunc(), bary_mul_normal(), bary_mul_precheck(), bary_mul_single(), bary_mul_toom3(), bary_pack(), bary_sq_fast(), bary_unpack(), big_shift3(), and str2big_normal().

#define BDIGMAX ((BDIGIT)(BIGRAD-1))

Definition at line 82 of file bignum.c.

Referenced by abs2twocomp(), bary_subb(), bary_unpack_internal(), big2dbl(), big_shift3(), bigand_int(), bigdivrem1(), bigor_int(), bigxor_int(), and integer_unpack_single_bdigit().

#define BIGDIVREM_EXTRA_WORDS 1

Definition at line 101 of file bignum.c.

Referenced by absint_numwords_generic(), bary_divmod_normal(), big2str_generic(), big2str_karatsuba(), bigdivrem(), and rb_big_divrem_normal().

#define BIGDN | ( |  | x | ) | RSHIFT((x),BITSPERDIG)

Definition at line 80 of file bignum.c.

Referenced by bary_addc(), bary_divmod(), bary_muladd_1xN(), bary_mulsub_1xN(), bary_small_lshift(), bary_sq_fast(), bary_subb(), bdigitdbl2bary(), bigadd_int(), bigand_int(), bigdivrem(), bigdivrem_mulsub(), bigor_int(), bigsub_int(), bigxor_int(), integer_unpack_push_bits(), rb_absint_singlebit_p(), rb_absint_size(), rb_integer_pack(), rb_uint2big(), str2big_karatsuba(), str2big_normal(), and str2big_poweroftwo().

#define BIGLO | ( |  | x | ) | ((BDIGIT)((x) & BDIGMAX))

Definition at line 81 of file bignum.c.

Referenced by bary_2comp(), bary_add_one(), bary_addc(), bary_divmod(), bary_muladd_1xN(), bary_mulsub_1xN(), bary_neg(), bary_small_lshift(), bary_small_rshift(), bary_sq_fast(), bary_subb(), bary_unpack_internal(), bdigitdbl2bary(), big2dbl(), bigadd_int(), bigand_int(), bigdivrem(), bigdivrem_mulsub(), bigor_int(), bigsub_int(), bigxor_int(), integer_unpack_push_bits(), integer_unpack_single_bdigit(), rb_absint_singlebit_p(), rb_absint_size(), rb_integer_pack(), rb_uint2big(), str2big_karatsuba(), str2big_normal(), and str2big_poweroftwo().

#define bignew | ( |  | len,
|  |  | sign
| ) |  | bignew_1(rb_cBignum,(len),(sign))

Definition at line 115 of file bignum.c.

Referenced by big_shift3(), bigadd(), bigadd_int(), bigand_int(), bigdivrem(), bigmul0(), bigor_int(), bigsq(), bigsub(), bigsub_int(), bigxor_int(), dbl2big(), power_cache_get_power(), rb_big_and(), rb_big_divrem_normal(), rb_big_mul_balance(), rb_big_mul_karatsuba(), rb_big_mul_normal(), rb_big_mul_toom3(), rb_big_new(), rb_big_or(), rb_big_sq_fast(), rb_big_xor(), rb_integer_unpack(), rb_uint2big(), str2big_karatsuba(), str2big_normal(), and str2big_poweroftwo().

#define BIGNUM_DEBUG 0

Definition at line 2871 of file bignum.c.

#define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)

Definition at line 76 of file bignum.c.

Referenced by big2dbl(), and dbl2big().

#define BIGRAD_HALF ((BDIGIT)(BIGRAD >> 1))

Definition at line 77 of file bignum.c.

#define BIGSIZE | ( |  | x | ) |

Value:
(RBIGNUM_LEN(x) == 0 ? (size_t)0 : \
BDIGITS(x)[RBIGNUM_LEN(x)-1] ? \
(size_t)(RBIGNUM_LEN(x)*SIZEOF_BDIGITS - nlz(BDIGITS(x)[RBIGNUM_LEN(x)-1])/CHAR_BIT) : \
rb_absint_size(x, NULL))
RBIGNUM_LEN
#define RBIGNUM_LEN(b)
Definition: ruby.h:1103
BDIGITS
#define BDIGITS(x)
Definition: bignum.c:74
rb_absint_size
size_t rb_absint_size(VALUE val, int *nlz_bits_ret)
Definition: bignum.c:3231
CHAR_BIT
#define CHAR_BIT
Definition: ruby.h:198
nlz
static int nlz(BDIGIT x)
Definition: bignum.c:159
SIZEOF_BDIGITS
#define SIZEOF_BDIGITS
Definition: bigdecimal.h:50
NULL
#define NULL
Definition: _sdbm.c:103

Definition at line 96 of file bignum.c.

Referenced by big2ulong(), rb_big_aref(), and rb_big_size().

#define BIGUP | ( |  | x | ) | LSHIFTX(((x) + (BDIGIT_DBL)0), BITSPERDIG)

Definition at line 79 of file bignum.c.

Referenced by bary2bdigitdbl(), bary_small_rshift(), bigdivrem1(), bigdivrem_single1(), bigfixize(), and rb_integer_unpack().

#define BIGZEROP | ( |  | x | ) |

Value:
(RBIGNUM_LEN(x) == 0 || \
(BDIGITS(x)[0] == 0 && \
(RBIGNUM_LEN(x) == 1 || bigzero_p(x))))
RBIGNUM_LEN
#define RBIGNUM_LEN(b)
Definition: ruby.h:1103
BDIGITS
#define BDIGITS(x)
Definition: bignum.c:74
bigzero_p
static int bigzero_p(VALUE x)
Definition: bignum.c:2897

Definition at line 93 of file bignum.c.

Referenced by big2str_find_n1(), big_shift2(), bigdivmod(), rb_big2str0(), rb_big_pow(), rb_bigzero_p(), and rb_cmpint().

#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)

Definition at line 75 of file bignum.c.

Referenced by bary_small_lshift(), bary_small_rshift(), bary_unpack_internal(), big2dbl(), big2str_find_n1(), big2str_generic(), big2ulong(), big_fdiv(), big_fdiv_int(), big_lshift(), big_rshift(), big_shift2(), integer_pack_fill_dd(), integer_unpack_num_bdigits(), integer_unpack_num_bdigits_generic(), integer_unpack_num_bdigits_small(), integer_unpack_push_bits(), rb_big2str1(), rb_big_aref(), rb_big_lshift(), rb_big_rshift(), and str2big_poweroftwo().

#define CLEAR_LOWBITS | ( |  | d,
|  |  | numbits
| ) |  | ((d) & LSHIFTX(~((d)*0), (numbits)))

Definition at line 70 of file bignum.c.

Referenced by bary_pack().

#define conv_digit | ( |  | c | ) | (ruby_digit36_to_number_table[(unsigned char)(c)])

Definition at line 3706 of file bignum.c.

Referenced by rb_cstr_to_inum(), str2big_karatsuba(), str2big_normal(), str2big_poweroftwo(), and str2big_scan_digits().

#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)

Referenced by big_fdiv(), and big_fdiv_int().

#define FILL_DD integer_pack_fill_dd(&dp, &de, &dd, &numbits_in_dd)

Referenced by bary_pack().

#define FILL_LOWBITS | ( |  | d,
|  |  | numbits
| ) |  | ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))

Definition at line 71 of file bignum.c.

Referenced by bary_pack().

#define GMP_BIG2STR_DIGITS 20

Definition at line 139 of file bignum.c.

Referenced by rb_big2str1().

#define GMP_DIV_DIGITS 20

Definition at line 138 of file bignum.c.

Referenced by bary_divmod_branch().

#define GMP_MUL_DIGITS 20

Definition at line 134 of file bignum.c.

Referenced by bary_mul(), and bigsq().

#define GMP_STR2BIG_DIGITS 20

Definition at line 140 of file bignum.c.

Referenced by rb_cstr_to_inum().

#define HOST_BIGENDIAN_P 0

Definition at line 64 of file bignum.c.

Referenced by bary_pack(), and bary_unpack_internal().

#define INTEGER_PACK_BYTEORDER_MASK

Value:
(INTEGER_PACK_MSBYTE_FIRST | \
INTEGER_PACK_LSBYTE_FIRST | \
INTEGER_PACK_NATIVE_BYTE_ORDER)
INTEGER_PACK_NATIVE_BYTE_ORDER
#define INTEGER_PACK_NATIVE_BYTE_ORDER
Definition: intern.h:146
INTEGER_PACK_LSBYTE_FIRST
#define INTEGER_PACK_LSBYTE_FIRST
Definition: intern.h:145
INTEGER_PACK_MSBYTE_FIRST
#define INTEGER_PACK_MSBYTE_FIRST
Definition: intern.h:144

Definition at line 484 of file bignum.c.

Referenced by bary_pack(), bary_unpack_internal(), integer_pack_loop_setup(), and validate_integer_pack_format().

#define INTEGER_PACK_WORDORDER_MASK

Value:
(INTEGER_PACK_MSWORD_FIRST | \
INTEGER_PACK_LSWORD_FIRST)
INTEGER_PACK_LSWORD_FIRST
#define INTEGER_PACK_LSWORD_FIRST
Definition: intern.h:143
INTEGER_PACK_MSWORD_FIRST
#define INTEGER_PACK_MSWORD_FIRST
Definition: intern.h:142

Definition at line 481 of file bignum.c.

Referenced by bary_pack(), bary_unpack_internal(), integer_pack_loop_setup(), and validate_integer_pack_format().

#define KARATSUBA_BALANCED | ( |  | xn,
|  |  | yn
| ) |  | ((yn)/2 < (xn))

Definition at line 131 of file bignum.c.

Referenced by bary_mul_balance_with_mulfunc(), bary_mul_karatsuba_branch(), and rb_big_mul_karatsuba().

#define KARATSUBA_MUL_DIGITS 70

Definition at line 135 of file bignum.c.

Referenced by bary_mul(), bary_mul_karatsuba_branch(), bigsq(), and rb_cstr_to_inum().

#define LSHIFTABLE | ( |  | d,
|  |  | n
| ) |  | ((n) < sizeof(d) * CHAR_BIT)

Definition at line 68 of file bignum.c.

#define LSHIFTX | ( |  | d,
|  |  | n
| ) |  | (!LSHIFTABLE(d, n) ? 0 : ((d) << (!LSHIFTABLE(d, n) ? 0 : (n))))

Definition at line 69 of file bignum.c.

Referenced by integer_unpack_single_bdigit().

#define MAX_BASE36_POWER_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)

Definition at line 4482 of file bignum.c.

Referenced by big2str_generic(), power_cache_get_power(), and power_cache_init().

#define ON_DEBUG | ( |  | x | ) |

Definition at line 2893 of file bignum.c.

#define POW2_P | ( |  | x | ) | (((x)&((x)-1))==0)

Definition at line 72 of file bignum.c.

Referenced by bary_mul_precheck(), bary_pack(), big_shift2(), bigdivrem_single1(), rb_absint_singlebit_p(), rb_big2str1(), rb_cstr_to_inum(), and rb_str2big_poweroftwo().

#define PUSH_BITS | ( |  | data,
|  |  | numbits
| ) |  | integer_unpack_push_bits(data, numbits, &dd, &numbits_in_dd, &dp)

Referenced by bary_unpack_internal().

#define QUAD_SIZE 8

Definition at line 3688 of file bignum.c.

Referenced by rb_quad_pack(), and rb_quad_unpack().

#define RB_BIGNUM_TYPE_P | ( |  | x | ) | RB_TYPE_P((x), T_BIGNUM)

Definition at line 33 of file bignum.c.

Referenced by big_op(), bignorm(), rb_big_and(), rb_big_aref(), rb_big_cmp(), rb_big_coerce(), rb_big_divide(), rb_big_divmod(), rb_big_eq(), rb_big_eql(), rb_big_fdiv(), rb_big_lshift(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_or(), rb_big_plus(), rb_big_pow(), rb_big_remainder(), rb_big_rshift(), rb_big_xor(), and rb_cmpint().

#define RBIGNUM_SET_LEN | ( |  | b,
|  |  | l
| ) |  |

Value:
((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
(void)(RBASIC(b)->flags = \
(RBASIC(b)->flags & ~RBIGNUM_EMBED_LEN_MASK) | \
((l) << RBIGNUM_EMBED_LEN_SHIFT)) : \
(void)(RBIGNUM(b)->as.heap.len = (l)))
RBIGNUM_EMBED_LEN_MASK
#define RBIGNUM_EMBED_LEN_MASK
Definition: ruby.h:1101
RBIGNUM
#define RBIGNUM(obj)
Definition: ruby.h:1128
RBIGNUM_EMBED_LEN_SHIFT
#define RBIGNUM_EMBED_LEN_SHIFT
Definition: ruby.h:1102
RBASIC
#define RBASIC(obj)
Definition: ruby.h:1116
RBIGNUM_EMBED_FLAG
#define RBIGNUM_EMBED_FLAG
Definition: ruby.h:1100

Definition at line 2930 of file bignum.c.

Referenced by bignew_1(), rb_big_realloc(), rb_big_resize(), and rb_uint2big().

#define RBIGNUM_SET_NEGATIVE_SIGN | ( |  | b | ) | RBIGNUM_SET_SIGN(b, 0)

Definition at line 112 of file bignum.c.

Referenced by bigsub(), and rb_big_neg().

#define RBIGNUM_SET_POSITIVE_SIGN | ( |  | b | ) | RBIGNUM_SET_SIGN(b, 1)

Definition at line 113 of file bignum.c.

Referenced by rb_big_neg().

#define roomof | ( |  | n,
|  |  | m
| ) |  | ((long)(((n)+(m)-1) / (m)))

Definition at line 102 of file bignum.c.

Referenced by rb_cstr_to_inum(), rb_str2big_karatsuba(), rb_str2big_normal(), and str2big_poweroftwo().

#define SIZEOF_BDIGIT_DBL SIZEOF_LONG_LONG

Definition at line 40 of file bignum.c.

Referenced by big2str_2bdigits().

#define TAKE_LOWBITS | ( |  | n | ) | integer_pack_take_lowbits(n, &dd, &numbits_in_dd)

Referenced by bary_pack().

#define TOOM3_BALANCED | ( |  | xn,
|  |  | yn
| ) |  | (((yn)+2)/3 * 2 < (xn))

Definition at line 132 of file bignum.c.

Referenced by bary_mul_balance_with_mulfunc(), bary_mul_toom3_branch(), and rb_big_mul_toom3().

#define TOOM3_MUL_DIGITS 150

Definition at line 136 of file bignum.c.

Referenced by bary_mul_toom3_branch().

#define U16 | ( |  | a | ) | ((uint16_t)(a))

Definition at line 168 of file bignum.c.

#define U32 | ( |  | a | ) | ((uint32_t)(a))

Definition at line 169 of file bignum.c.

## Typedef Documentation

typedef void( mulfunc_t)(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)

Definition at line 142 of file bignum.c.

## Enumeration Type Documentation

enum big_op_t

Enumerator
big_op_gt |
big_op_ge |
big_op_lt |
big_op_le |

Definition at line 5419 of file bignum.c.

## Function Documentation

static BDIGIT abs2twocomp | ( | VALUE * | xp,
|  | long * | n_ret
| ) |  |
| static

Definition at line 3039 of file bignum.c.

References bary_2comp(), BARY_TRUNC, BDIGIT, BDIGITS, BDIGMAX, bignew_1(), CLASS_OF, MEMCPY, RBIGNUM_LEN, and RBIGNUM_NEGATIVE_P.

Referenced by big_shift3(), rb_big_and(), rb_big_or(), and rb_big_xor().

static size_t absint_numwords_generic | ( | size_t | numbytes,
|  | int | nlz_bits_in_msbyte,
|  | size_t | word_numbits,
|  | size_t * | nlz_bits_ret
| ) |  |
| static

Definition at line 3292 of file bignum.c.

References BARY_ADD, BARY_ARGS, BARY_DIVMOD, bary_pack(), BARY_SHORT_MUL, BARY_SUB, bary_unpack(), BARY_ZERO_P, BDIGIT, bdigit_roomof, BIGDIVREM_EXTRA_WORDS, CHAR_BIT, INTEGER_PACK_NATIVE_BYTE_ORDER, mod, numberof, and one().

Referenced by rb_absint_numwords().

static size_t absint_numwords_small | ( | size_t | numbytes,
|  | int | nlz_bits_in_msbyte,
|  | size_t | word_numbits,
|  | size_t * | nlz_bits_ret
| ) |  |
| static

Definition at line 3278 of file bignum.c.

References CHAR_BIT, div, and mod.

Referenced by rb_absint_numwords().

static BDIGIT_DBL bary2bdigitdbl | ( | const BDIGIT * | ds,
|  | size_t | n
| ) |  |
| inline static

Definition at line 360 of file bignum.c.

References assert, and BIGUP.

Referenced by bary_divmod(), big2str_2bdigits(), and bigdivrem().

static int bary_2comp | ( | BDIGIT * | ds,
|  | size_t | n
| ) |  |
| static

Definition at line 449 of file bignum.c.

References BIGLO.

Referenced by abs2twocomp(), bary_mul_karatsuba(), bary_mul_toom3(), bary_pack(), bary_unpack_internal(), bigsub(), and get2comp().

static int bary_add | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 1422 of file bignum.c.

References bary_addc().

Referenced by bary_mul_balance_with_mulfunc(), bary_mul_karatsuba(), bary_mul_toom3(), bigadd(), bigdivrem1(), and str2big_karatsuba().

static int bary_add_one | ( | BDIGIT * | ds,
|  | size_t | n
| ) |  |
| static

Definition at line 1428 of file bignum.c.

References BIGLO.

Referenced by bary_mul_karatsuba(), and rb_big_neg().

static int bary_addc | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | int | carry
| ) |  |
| static

Definition at line 1376 of file bignum.c.

References assert, BDIGIT, BDIGIT_DBL, BIGDN, and BIGLO.

Referenced by bary_add(), and bary_mul_karatsuba().

static int bary_cmp | ( | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 381 of file bignum.c.

References BARY_TRUNC.

Referenced by big2str_karatsuba(), and rb_big_cmp().

static void bary_divmod | ( | BDIGIT * | qds,
|  | size_t | qn,
|  | BDIGIT * | rds,
|  | size_t | rn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 2826 of file bignum.c.

References assert, bary2bdigitdbl(), bary_divmod_branch(), BARY_TRUNC, BDIGIT, BDIGIT_DBL, BDIGITS_ZERO, bigdivrem_single(), BIGDN, BIGLO, MEMCPY, and rb_num_zerodiv().

static void bary_divmod_branch | ( | BDIGIT * | qds,
|  | size_t | qn,
|  | BDIGIT * | rds,
|  | size_t | rn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 2814 of file bignum.c.

References bary_divmod_normal(), and GMP_DIV_DIGITS.

Referenced by bary_divmod(), and bigdivrem().

static void bary_divmod_normal | ( | BDIGIT * | qds,
|  | size_t | qn,
|  | BDIGIT * | rds,
|  | size_t | rn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 2637 of file bignum.c.

References ALLOCV_END, ALLOCV_N, assert, bary_small_lshift(), bary_small_rshift(), BDIGIT, BDIGITS_ZERO, BIGDIVREM_EXTRA_WORDS, bigdivrem_restoring(), MEMCPY, MEMMOVE, nlz(), shift(), big_div_struct::yn, big_div_struct::zds, and big_div_struct::zn.

Referenced by bary_divmod_branch(), and rb_big_divrem_normal().

static void bary_mul | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 2488 of file bignum.c.

References bary_mul_toom3_start, bary_short_mul(), bary_sq_fast(), GMP_MUL_DIGITS, KARATSUBA_MUL_DIGITS, and NULL.

Referenced by bigmul0(), bigsq(), and str2big_karatsuba().

static void bary_mul_balance_with_mulfunc | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn,
|  | mulfunc_t * | mulfunc
| ) |  |
| static

Definition at line 1620 of file bignum.c.

References ALLOCV_END, ALLOCV_N, assert, bary_add(), BDIGIT, BDIGITS_ZERO, KARATSUBA_BALANCED, MEMCPY, and TOOM3_BALANCED.

Referenced by bary_mul_karatsuba_branch(), bary_mul_toom3_branch(), and rb_big_mul_balance().

static void bary_mul_karatsuba | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn
| ) |  |
| static

Definition at line 1680 of file bignum.c.

References ALLOCV_END, ALLOCV_N, assert, bary_2comp(), bary_add(), bary_add_one(), bary_addc(), bary_mul_karatsuba_start, bary_muladd_1xN(), bary_sub(), bary_sub_one(), BDIGIT, and MEMCPY.

Referenced by bary_mul_karatsuba_branch(), and rb_big_mul_karatsuba().

static void bary_mul_karatsuba_branch | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn
| ) |  |
| static

Definition at line 2424 of file bignum.c.

References bary_mul_balance_with_mulfunc(), bary_mul_karatsuba(), bary_short_mul(), bary_sparse_p(), bary_sq_fast(), KARATSUBA_BALANCED, and KARATSUBA_MUL_DIGITS.

Referenced by bary_mul_karatsuba_start(), and bary_mul_toom3_branch().

static void bary_mul_karatsuba_start | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn
| ) |  |
| static

Definition at line 2454 of file bignum.c.

References bary_mul_karatsuba_branch(), and bary_mul_precheck().

static void bary_mul_normal | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 1527 of file bignum.c.

References assert, bary_muladd_1xN(), and BDIGITS_ZERO.

Referenced by bary_mul_precheck(), bary_short_mul(), and rb_big_mul_normal().

static int bary_mul_precheck | ( | BDIGIT ** | zdsp,
|  | size_t * | znp,
|  | const BDIGIT ** | xdsp,
|  | size_t * | xnp,
|  | const BDIGIT ** | ydsp,
|  | size_t * | ynp
| ) |  |
| static

Definition at line 2326 of file bignum.c.

References assert, bary_mul_normal(), bary_small_lshift(), BDIGIT, BDIGITS_ZERO, bit_length, MEMCPY, and POW2_P.

Referenced by bary_mul_karatsuba_start(), and bary_mul_toom3_start().

static void bary_mul_single | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | BDIGIT | x,
|  | BDIGIT | y
| ) |  |
| static

Definition at line 1440 of file bignum.c.

References assert, BDIGIT_DBL, bdigitdbl2bary(), and BDIGITS_ZERO.

Referenced by bary_short_mul().

static void bary_mul_toom3 | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn
| ) |  |
| static

Definition at line 1862 of file bignum.c.

References ALLOCV_END, ALLOCV_N, assert, bary_2comp(), bary_add(), bary_mul_toom3_start, bary_muladd_1xN(), bary_mulsub_1xN(), bary_small_lshift(), bary_small_rshift(), bary_sub(), BARY_TRUNC, BDIGIT, BDIGITS_ZERO, bigdivrem_single(), and MEMCPY.

Referenced by bary_mul_toom3_branch(), and rb_big_mul_toom3().

static void bary_mul_toom3_branch | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn
| ) |  |
| static

Definition at line 2463 of file bignum.c.

References bary_mul_balance_with_mulfunc(), bary_mul_karatsuba_branch(), bary_mul_toom3(), TOOM3_BALANCED, and TOOM3_MUL_DIGITS.

Referenced by bary_mul_toom3_start().

static void bary_mul_toom3_start | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | BDIGIT * | wds,
|  | size_t | wn
| ) |  |
| static

Definition at line 2479 of file bignum.c.

References bary_mul_precheck(), and bary_mul_toom3_branch().

static int bary_muladd_1xN | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | BDIGIT | x,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 1452 of file bignum.c.

References assert, BDIGIT_DBL, BIGDN, and BIGLO.

Referenced by bary_mul_karatsuba(), bary_mul_normal(), and bary_mul_toom3().

static int bary_mulsub_1xN | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | BDIGIT | x,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 1513 of file bignum.c.

References assert, BDIGIT_DBL_SIGNED, bigdivrem_mulsub(), BIGDN, and BIGLO.

Referenced by bary_mul_toom3().

static void bary_neg | ( | BDIGIT * | ds,
|  | size_t | n
| ) |  |
| static

Definition at line 442 of file bignum.c.

References BIGLO.

Referenced by rb_big_neg().

static int bary_pack | ( | int | sign,
|  | BDIGIT * | ds,
|  | size_t | num_bdigits,
|  | void * | words,
|  | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags
| ) |  |
| static

Definition at line 627 of file bignum.c.

References ALIGNOF, bary_2comp(), bary_swap(), BDIGIT, BDIGIT_DBL, BDIGIT_DBL_SIGNED, BDIGITS_ZERO, buf, bytes_2comp(), CHAR_BIT, CLEAR_LOWBITS, dp, FILL_DD, FILL_LOWBITS, HOST_BIGENDIAN_P, INTEGER_PACK_2COMP, INTEGER_PACK_BYTEORDER_MASK, INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION, integer_pack_loop_setup(), INTEGER_PACK_LSBYTE_FIRST, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_MSBYTE_FIRST, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, INTEGER_PACK_WORDORDER_MASK, MEMCPY, MEMZERO, POW2_P, SIZEOF_BDIGITS, swap16, swap32, TAKE_LOWBITS, and validate_integer_pack_format().

Referenced by absint_numwords_generic(), and rb_integer_pack().

static void bary_short_mul | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 2299 of file bignum.c.

References assert, bary_mul_normal(), bary_mul_single(), and rb_thread_check_ints().

Referenced by bary_mul(), and bary_mul_karatsuba_branch().

static BDIGIT bary_small_lshift | ( | BDIGIT * | zds,
|  | const BDIGIT * | xds,
|  | size_t | n,
|  | int | shift
| ) |  |
| static

Definition at line 399 of file bignum.c.

References assert, BDIGIT_DBL, BIGDN, BIGLO, and BITSPERDIG.

Referenced by bary_divmod_normal(), bary_mul_precheck(), bary_mul_toom3(), big2str_karatsuba(), and big_shift3().

static void bary_small_rshift | ( | BDIGIT * | zds,
|  | const BDIGIT * | xds,
|  | size_t | n,
|  | int | shift,
|  | BDIGIT | higher_bdigit
| ) |  |
| static

Definition at line 414 of file bignum.c.

References assert, BDIGIT, BDIGIT_DBL, BIGLO, BIGUP, and BITSPERDIG.

Referenced by bary_divmod_normal(), bary_mul_toom3(), big2str_karatsuba(), big_shift3(), and bigdivrem_single1().

static int bary_sparse_p | ( | const BDIGIT * | ds,
|  | size_t | n
| ) |  |
| inline static

Definition at line 2314 of file bignum.c.

References rb_genrand_ulong_limited().

Referenced by bary_mul_karatsuba_branch().

static void bary_sq_fast | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn
| ) |  |
| static

Definition at line 1555 of file bignum.c.

References assert, BDIGIT, BDIGIT_DBL, BDIGITS_ZERO, BIGDN, and BIGLO.

Referenced by bary_mul(), bary_mul_karatsuba_branch(), bigsq(), and rb_big_sq_fast().

static int bary_sub | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 1364 of file bignum.c.

References bary_subb().

Referenced by bary_mul_karatsuba(), bary_mul_toom3(), and bigsub().

static int bary_sub_one | ( | BDIGIT * | zds,
|  | size_t | zn
| ) |  |
| static

Definition at line 1370 of file bignum.c.

References bary_subb(), and NULL.

Referenced by bary_mul_karatsuba().

static int bary_subb | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | const BDIGIT * | yds,
|  | size_t | yn,
|  | int | borrow
| ) |  |
| static

Definition at line 1313 of file bignum.c.

References assert, BDIGIT_DBL_SIGNED, BDIGMAX, BIGDN, and BIGLO.

Referenced by bary_sub(), and bary_sub_one().

static void bary_swap | ( | BDIGIT * | ds,
|  | size_t | num_bdigits
| ) |  |
| static

Definition at line 470 of file bignum.c.

References BDIGIT.

Referenced by bary_pack(), and bary_unpack_internal().

static void bary_unpack | ( | BDIGIT * | bdigits,
|  | size_t | num_bdigits,
|  | const void * | words,
|  | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags
| ) |  |
| static

Definition at line 1281 of file bignum.c.

References assert, bary_unpack_internal(), BDIGITS_ZERO, INTEGER_PACK_2COMP, INTEGER_PACK_FORCE_BIGNUM, INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION, INTEGER_PACK_LSBYTE_FIRST, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_MSBYTE_FIRST, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, INTEGER_PACK_NEGATIVE, integer_unpack_num_bdigits(), and validate_integer_pack_format().

Referenced by absint_numwords_generic(), and rb_big_bit_length().

static int bary_unpack_internal | ( | BDIGIT * | bdigits,
|  | size_t | num_bdigits,
|  | const void * | words,
|  | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags,
|  | int | nlp_bits
| ) |  |
| static

Definition at line 1081 of file bignum.c.

References ALIGNOF, assert, bary_2comp(), bary_swap(), bary_zero_p(), BDIGIT, BDIGIT_DBL, BDIGIT_MSB, BDIGMAX, BIGLO, BITSPERDIG, buf, CHAR_BIT, dp, HOST_BIGENDIAN_P, INTEGER_PACK_2COMP, INTEGER_PACK_BYTEORDER_MASK, INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION, integer_pack_loop_setup(), INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_MSBYTE_FIRST, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, INTEGER_PACK_NEGATIVE, INTEGER_PACK_WORDORDER_MASK, integer_unpack_single_bdigit(), MEMCPY, MEMZERO, PUSH_BITS, SIZEOF_BDIGITS, swap16, and swap32.

Referenced by bary_unpack(), and rb_integer_unpack().

static int bary_zero_p | ( | BDIGIT * | xds,
|  | size_t | xn
| ) |  |
| static

Definition at line 431 of file bignum.c.

Referenced by bary_unpack_internal(), big2str_karatsuba(), big_shift3(), bigzero_p(), and rb_integer_unpack().

static void bdigitdbl2bary | ( | BDIGIT * | ds,
|  | size_t | n,
|  | BDIGIT_DBL | num
| ) |  |
| inline static

Definition at line 372 of file bignum.c.

References assert, BDIGIT, BIGDN, and BIGLO.

Referenced by bary_mul_single(), and power_cache_get_power().

static double big2dbl | ( | VALUE | x | ) |
| static

Definition at line 5219 of file bignum.c.

References BDIGIT, BDIGITS, BDIGMAX, BIGLO, BIGRAD, bigtrunc(), BITSPERDIG, DBL_MANT_DIG, DBL_MAX_EXP, lo, nlz(), RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by big_fdiv(), rb_big2dbl(), and rb_big_fdiv().

static void big2str_2bdigits | ( | struct big2str_struct * | b2s,
|  | BDIGIT * | xds,
|  | size_t | xn,
|  | size_t | taillen
| ) |  |
| static

Definition at line 4618 of file bignum.c.

References assert, bary2bdigitdbl(), big2str_struct::base, BDIGIT_DBL, big2str_alloc(), buf, CHAR_BIT, big2str_struct::hbase2_numdigits, MEMCPY, big2str_struct::ptr, ruby_digitmap, and SIZEOF_BDIGIT_DBL.

Referenced by big2str_generic(), and big2str_karatsuba().

static void big2str_alloc | ( | struct big2str_struct * | b2s,
|  | size_t | len
| ) |  |
| static

Definition at line 4607 of file bignum.c.

References LONG_MAX, big2str_struct::negative, big2str_struct::ptr, rb_eArgError, rb_raise(), rb_usascii_str_new(), big2str_struct::result, and RSTRING_PTR.

Referenced by big2str_2bdigits().

static VALUE big2str_base_poweroftwo | ( | VALUE | x,
|  | int | base
| ) |  |
| static

Definition at line 4778 of file bignum.c.

References CHAR_BIT, ffs(), INTEGER_PACK_BIG_ENDIAN, LONG_MAX, NULL, rb_absint_numwords(), rb_eArgError, rb_integer_pack(), rb_raise(), rb_usascii_str_new(), RBIGNUM_NEGATIVE_P, RBIGNUM_POSITIVE_P, result, RSTRING_PTR, and ruby_digitmap.

Referenced by rb_big2str1(), and rb_big2str_poweroftwo().

static long big2str_find_n1 | ( | VALUE | x,
|  | int | base
| ) |  |
| static

Definition at line 4559 of file bignum.c.

References BIGZEROP, BITSPERDIG, CHAR_BIT, FIXNUM_P, LONG_MAX, rb_bug(), rb_eRangeError, rb_raise(), and RBIGNUM_LEN.

Referenced by rb_big2str0().

static VALUE big2str_generic | ( | VALUE | x,
|  | int | base
| ) |  |
| static

Definition at line 4815 of file bignum.c.

References ALLOCV_END, ALLOCV_N, assert, BARY_TRUNC, big2str_struct::base, BDIGIT, BDIGITS, big2str_2bdigits(), big2str_karatsuba(), BIGDIVREM_EXTRA_WORDS, BITSPERDIG, big2str_struct::hbase2, big2str_struct::hbase2_numdigits, LONG_MAX, MAX_BASE36_POWER_TABLE_ENTRIES, maxpow_in_bdigit_dbl(), MEMCPY, big2str_struct::negative, NULL, power_cache_get_power(), big2str_struct::ptr, Qnil, rb_eArgError, rb_eRangeError, RB_GC_GUARD, rb_raise(), rb_str_resize(), rb_usascii_str_new2, RBIGNUM_LEN, RBIGNUM_NEGATIVE_P, big2str_struct::result, and RSTRING_PTR.

Referenced by rb_big2str1(), and rb_big2str_generic().

static void big2str_karatsuba | ( | struct big2str_struct * | b2s,
|  | BDIGIT * | xds,
|  | size_t | xn,
|  | size_t | wn,
|  | int | power_level,
|  | size_t | taillen
| ) |  |
| static

Definition at line 4655 of file bignum.c.

References assert, bary_cmp(), bary_small_lshift(), bary_small_rshift(), BARY_TRUNC, bary_zero_p(), big2str_struct::base, BDIGIT, BDIGITS, big2str_2bdigits(), BIGDIVREM_EXTRA_WORDS, bigdivrem_restoring(), nlz(), power_cache_get_power(), big2str_struct::ptr, RBIGNUM_LEN, and shift().

Referenced by big2str_generic().

static unsigned long big2ulong | ( | VALUE | x,
|  | const char * | type
| ) |  |
| static

Definition at line 5049 of file bignum.c.

References BDIGIT, BDIGITS, BIGSIZE, BITSPERDIG, rb_eRangeError, rb_raise(), and RBIGNUM_LEN.

Referenced by rb_big2long(), rb_big2ulong(), and rb_big_aref().

static void big_extend_carry | ( | VALUE | x | ) |
| static

Definition at line 3014 of file bignum.c.

References BDIGITS, rb_big_resize(), and RBIGNUM_LEN.

Referenced by get2comp(), rb_big_neg(), and rb_integer_unpack().

static VALUE big_fdiv | ( | VALUE | x,
|  | VALUE | y,
|  | long | ey
| ) |  |
| static

Definition at line 6263 of file bignum.c.

References BDIGITS, big2dbl(), big_shift(), bigdivrem(), bigtrunc(), BITSPERDIG, DBL2NUM, DBL_BIGDIG, INFINITY, nlz(), and RBIGNUM_LEN.

Referenced by big_fdiv_float(), and big_fdiv_int().

static VALUE big_fdiv_float | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 6300 of file bignum.c.

References big_fdiv(), dbl2big(), DBL_MANT_DIG, and RFLOAT_VALUE.

Referenced by rb_big_fdiv().

static VALUE big_fdiv_int | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 6288 of file bignum.c.

References BDIGITS, big_fdiv(), big_shift(), bigtrunc(), BITSPERDIG, DBL_BIGDIG, nlz(), and RBIGNUM_LEN.

Referenced by rb_big_fdiv().

static VALUE big_ge | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 5484 of file bignum.c.

References big_op(), and big_op_ge.

Referenced by Init_Bignum().

static VALUE big_gt | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 5470 of file bignum.c.

References big_op(), and big_op_gt.

Referenced by Init_Bignum().

static VALUE big_le | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 5512 of file bignum.c.

References big_op(), and big_op_le.

Referenced by Init_Bignum().

static VALUE big_lshift | ( | VALUE | x,
|  | unsigned long | shift
| ) |  |
| static

Definition at line 4467 of file bignum.c.

References big_shift3(), and BITSPERDIG.

Referenced by big_shift().

static VALUE big_lt | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 5498 of file bignum.c.

References big_op(), and big_op_lt.

Referenced by Init_Bignum().

static VALUE big_op | ( | VALUE | x,
|  | VALUE | y,
|  | enum big_op_t | op
| ) |  |
| static

Definition at line 5427 of file bignum.c.

References big_op_ge, big_op_gt, big_op_le, big_op_lt, FIX2INT, FIXNUM_P, NIL_P, Qfalse, Qtrue, Qundef, rb_big_cmp(), RB_BIGNUM_TYPE_P, RB_FLOAT_TYPE_P, rb_integer_float_cmp(), rb_intern, and rb_num_coerce_relop().

Referenced by big_ge(), big_gt(), big_le(), and big_lt().

static VALUE big_rshift | ( | VALUE | x,
|  | unsigned long | shift
| ) |  |
| static

Definition at line 4475 of file bignum.c.

References big_shift3(), and BITSPERDIG.

Referenced by big_shift().

static VALUE big_shift | ( | VALUE | x,
|  | long | n
| ) |  |
| static

Definition at line 6253 of file bignum.c.

References big_lshift(), and big_rshift().

Referenced by big_fdiv(), and big_fdiv_int().

static VALUE big_shift2 | ( | VALUE | x,
|  | int | lshift_p,
|  | VALUE | y
| ) |  |
| static

Definition at line 4434 of file bignum.c.

References assert, big_shift3(), BIGZEROP, bit_length, BITSPERDIG, CHAR_BIT, INT2FIX, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, numberof, POW2_P, rb_eRangeError, rb_integer_pack(), rb_raise(), and RBIGNUM_POSITIVE_P.

Referenced by rb_big_lshift(), and rb_big_rshift().

static VALUE big_shift3 | ( | VALUE | x,
|  | int | lshift_p,
|  | size_t | shift_numdigits,
|  | int | shift_numbits
| ) |  |
| static

Definition at line 4385 of file bignum.c.

References abs2twocomp(), bary_small_lshift(), bary_small_rshift(), bary_zero_p(), BDIGIT, BDIGITS, BDIGITS_ZERO, BDIGMAX, bignew, INT2FIX, LONG_MAX, rb_eArgError, RB_GC_GUARD, rb_raise(), RBIGNUM_LEN, RBIGNUM_POSITIVE_P, RBIGNUM_SIGN, twocomp2abs_bang(), big_div_struct::zds, and big_div_struct::zn.

Referenced by big_lshift(), big_rshift(), big_shift2(), rb_big_lshift(), and rb_big_rshift().

static VALUE bigadd | ( | VALUE | x,
|  | VALUE | y,
|  | int | sign
| ) |  |
| static

Definition at line 5833 of file bignum.c.

References bary_add(), BDIGITS, bignew, bigsub(), RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by bigdivmod(), rb_big_minus(), and rb_big_plus().

static VALUE bigadd_int | ( | VALUE | x,
|  | long | y
| ) |  |
| static

Definition at line 5750 of file bignum.c.

References BDIGIT, BDIGIT_DBL, bdigit_roomof, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), LONG2NUM, RB_GC_GUARD, RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by rb_big_minus(), and rb_big_plus().

static VALUE bigand_int | ( | VALUE | x,
|  | long | xn,
|  | BDIGIT | hibitsx,
|  | long | y
| ) |  |
| static

Definition at line 6417 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BDIGMAX, BIGDN, BIGLO, bignew, bignorm(), INT2FIX, LONG2NUM, RB_GC_GUARD, and twocomp2abs_bang().

Referenced by rb_big_and().

static void bigdivmod | ( | VALUE | x,
|  | VALUE | y,
|  | volatile VALUE * | divp,
|  | volatile VALUE * | modp
| ) |  |
| static

Definition at line 6108 of file bignum.c.

References bigadd(), bigdivrem(), BIGZEROP, mod, rb_int2big(), and RBIGNUM_SIGN.

Referenced by rb_big_divide(), rb_big_divmod(), and rb_big_modulo().

static VALUE bigdivrem | ( | VALUE | x,
|  | VALUE | y,
|  | volatile VALUE * | divp,
|  | volatile VALUE * | modp
| ) |  |
| static

Definition at line 6015 of file bignum.c.

References bary2bdigitdbl(), bary_divmod_branch(), BARY_TRUNC, BDIGIT, BDIGIT_DBL, bdigit_roomof, BDIGITS, BIGDIVREM_EXTRA_WORDS, bigdivrem_single(), BIGDN, BIGLO, bignew, bigtrunc(), NULL, Qnil, rb_int2big(), rb_num_zerodiv(), rb_uint2big(), RBIGNUM_LEN, RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.

Referenced by big_fdiv(), bigdivmod(), and rb_big_remainder().

static void* bigdivrem1 | ( | void * | ptr | ) |
| static

Definition at line 2525 of file bignum.c.

References bary_add(), BDIGIT, BDIGIT_DBL_SIGNED, BDIGMAX, bigdivrem_mulsub(), BIGUP, big_div_struct::stop, big_div_struct::yds, big_div_struct::yn, big_div_struct::zds, and big_div_struct::zn.

Referenced by bigdivrem_restoring().

static BDIGIT_DBL_SIGNED bigdivrem_mulsub | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | BDIGIT | x,
|  | const BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 1487 of file bignum.c.

References assert, BDIGIT_DBL, BDIGIT_DBL_SIGNED, BIGDN, and BIGLO.

Referenced by bary_mulsub_1xN(), and bigdivrem1().

static void bigdivrem_restoring | ( | BDIGIT * | zds,
|  | size_t | zn,
|  | BDIGIT * | yds,
|  | size_t | yn
| ) |  |
| static

Definition at line 2598 of file bignum.c.

References assert, BDIGIT, BDIGIT_MSB, bigdivrem1(), bigdivrem_single1(), Qfalse, Qtrue, rb_big_stop(), rb_thread_call_without_gvl(), big_div_struct::stop, big_div_struct::yds, big_div_struct::yn, big_div_struct::zds, and big_div_struct::zn.

Referenced by bary_divmod_normal(), and big2str_karatsuba().

static BDIGIT bigdivrem_single | ( | BDIGIT * | qds,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | BDIGIT | y
| ) |  |
| static

Definition at line 2592 of file bignum.c.

References bigdivrem_single1().

Referenced by bary_divmod(), bary_mul_toom3(), and bigdivrem().

static BDIGIT bigdivrem_single1 | ( | BDIGIT * | qds,
|  | const BDIGIT * | xds,
|  | size_t | xn,
|  | BDIGIT | x_higher_bdigit,
|  | BDIGIT | y
| ) |  |
| static

Definition at line 2567 of file bignum.c.

References assert, bary_small_rshift(), BDIGIT, BDIGIT_DBL, BIGUP, bit_length, and POW2_P.

Referenced by bigdivrem_restoring(), and bigdivrem_single().

static VALUE bigfixize | ( | VALUE | x | ) |
| inline static

Definition at line 3083 of file bignum.c.

References BARY_TRUNC, BDIGIT, BDIGITS, BIGUP, FIXNUM_MIN, INT2FIX, LONG2FIX, POSFIXABLE, rb_big_resize(), RBIGNUM_LEN, RBIGNUM_POSITIVE_P, and SIZEOF_BDIGITS.

Referenced by bignorm().

static VALUE bigmul0 | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 5963 of file bignum.c.

References bary_mul(), BDIGIT, BDIGITS, bignew, bigsq(), RB_GC_GUARD, RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by rb_big_mul(), and rb_big_pow().

static VALUE bignew_1 | ( | VALUE | klass,
|  | long | len,
|  | int | sign
| ) |  |
| static

Definition at line 2980 of file bignum.c.

References ALLOC_N, BDIGIT, FL_WB_PROTECTED, NEWOBJ_OF, OBJ_FREEZE, RBASIC, RBIGNUM, RBIGNUM_EMBED_FLAG, RBIGNUM_EMBED_LEN_MAX, RBIGNUM_SET_LEN, RBIGNUM_SET_SIGN, RGENGC_WB_PROTECTED_BIGNUM, T_BIGNUM, and VALGRIND_MAKE_MEM_UNDEFINED.

Referenced by abs2twocomp(), and rb_big_clone().

static VALUE bignorm | ( | VALUE | x | ) |
| static

Definition at line 3127 of file bignum.c.

References bigfixize(), and RB_BIGNUM_TYPE_P.

Referenced by bigadd_int(), bigand_int(), bigor_int(), bigsub_int(), bigxor_int(), rb_big_and(), rb_big_divide(), rb_big_divmod(), rb_big_eq(), rb_big_lshift(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_neg(), rb_big_norm(), rb_big_or(), rb_big_plus(), rb_big_pow(), rb_big_remainder(), rb_big_rshift(), rb_big_uminus(), rb_big_xor(), rb_cstr_to_inum(), rb_dbl2big(), rb_integer_unpack(), rb_str2big_karatsuba(), rb_str2big_normal(), and rb_str2big_poweroftwo().

static VALUE bigor_int | ( | VALUE | x,
|  | long | xn,
|  | BDIGIT | hibitsx,
|  | long | y
| ) |  |
| static

Definition at line 6530 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BDIGMAX, BIGDN, BIGLO, bignew, bignorm(), INT2FIX, LONG2FIX, RB_GC_GUARD, RBIGNUM_LEN, and twocomp2abs_bang().

Referenced by rb_big_or().

static VALUE bigsq | ( | VALUE | x | ) |
| static

Definition at line 5932 of file bignum.c.

References bary_mul(), bary_sq_fast(), BDIGIT, BDIGITS, bignew, GMP_MUL_DIGITS, KARATSUBA_MUL_DIGITS, RB_GC_GUARD, and RBIGNUM_LEN.

Referenced by bigmul0(), power_cache_get_power(), and rb_big_pow().

static VALUE bigsub | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 5626 of file bignum.c.

References bary_2comp(), bary_sub(), BDIGIT, BDIGITS, bignew, RBIGNUM_LEN, and RBIGNUM_SET_NEGATIVE_SIGN.

Referenced by bigadd().

static VALUE bigsub_int | ( | VALUE | x,
|  | long | y0
| ) |  |
| static

Definition at line 5653 of file bignum.c.

References assert, BDIGIT, BDIGIT_DBL_SIGNED, bdigit_roomof, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), get2comp(), LONG2NUM, RB_GC_GUARD, RBIGNUM_LEN, RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.

Referenced by rb_big_minus(), and rb_big_plus().

static VALUE bigtrunc | ( | VALUE | x | ) |
| inline static

Definition at line 3069 of file bignum.c.

References BDIGIT, BDIGITS, rb_big_resize(), and RBIGNUM_LEN.

Referenced by big2dbl(), big_fdiv(), big_fdiv_int(), bigdivrem(), power_cache_get_power(), rb_big2str1(), rb_big_aref(), rb_big_divrem_normal(), rb_big_pow(), and rb_integer_unpack().

static VALUE bigxor_int | ( | VALUE | x,
|  | long | xn,
|  | BDIGIT | hibitsx,
|  | long | y
| ) |  |
| static

Definition at line 6656 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BDIGMAX, BIGDN, BIGLO, bignew, bignorm(), RB_GC_GUARD, RBIGNUM_LEN, and twocomp2abs_bang().

Referenced by rb_big_xor().

static int bigzero_p | ( | VALUE | x | ) |
| static

Definition at line 2897 of file bignum.c.

References bary_zero_p(), BDIGITS, and RBIGNUM_LEN.

static int bytes_2comp | ( | unsigned char * | buf,
|  | size_t | len
| ) |  |
| static

Definition at line 612 of file bignum.c.

Referenced by bary_pack().

static VALUE dbl2big | ( | double | d | ) |
| static

Definition at line 5181 of file bignum.c.

References BDIGIT, BDIGITS, bignew, BIGRAD, isinf(), isnan, rb_eFloatDomainError, and rb_raise().

Referenced by big_fdiv_float(), and rb_dbl2big().

static void get2comp | ( | VALUE | x | ) |
| static

Definition at line 3022 of file bignum.c.

References bary_2comp(), BDIGIT, BDIGITS, big_extend_carry(), and RBIGNUM_LEN.

Referenced by bigsub_int(), rb_big_2comp(), and twocomp2abs_bang().

void Init_Bignum | ( | void |  | ) |

Definition at line 7090 of file bignum.c.

References big_ge(), big_gt(), big_le(), big_lt(), power_cache_init(), rb_big_abs(), rb_big_and(), rb_big_aref(), rb_big_bit_length(), rb_big_cmp(), rb_big_coerce(), rb_big_div(), rb_big_divmod(), rb_big_eq(), rb_big_eql(), rb_big_even_p(), rb_big_fdiv(), rb_big_hash(), rb_big_idiv(), rb_big_lshift(), rb_big_minus(), rb_big_modulo(), rb_big_mul(), rb_big_neg(), rb_big_odd_p(), rb_big_or(), rb_big_plus(), rb_big_pow(), rb_big_remainder(), rb_big_rshift(), rb_big_size(), rb_big_to_f(), rb_big_to_s(), rb_big_uminus(), rb_big_xor(), rb_cBignum, rb_cInteger, rb_define_alias(), rb_define_class(), rb_define_const(), rb_define_method(), and rb_sprintf().

static void integer_pack_fill_dd | ( | BDIGIT ** | dpp,
|  | BDIGIT ** | dep,
|  | BDIGIT_DBL * | ddp,
|  | int * | numbits_in_dd_p
| ) |  |
| inline static

Definition at line 588 of file bignum.c.

References BDIGIT_DBL, BITSPERDIG, and CHAR_BIT.

static void integer_pack_loop_setup | ( | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags,
|  | size_t * | word_num_fullbytes_ret,
|  | int * | word_num_partialbits_ret,
|  | size_t * | word_start_ret,
|  | ssize_t * | word_step_ret,
|  | size_t * | word_last_ret,
|  | size_t * | byte_start_ret,
|  | int * | byte_step_ret
| ) |  |
| static

Definition at line 523 of file bignum.c.

References CHAR_BIT, INTEGER_PACK_BYTEORDER_MASK, INTEGER_PACK_LSBYTE_FIRST, INTEGER_PACK_MSBYTE_FIRST, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, and INTEGER_PACK_WORDORDER_MASK.

Referenced by bary_pack(), and bary_unpack_internal().

static BDIGIT_DBL integer_pack_take_lowbits | ( | int | n,
|  | BDIGIT_DBL * | ddp,
|  | int * | numbits_in_dd_p
| ) |  |
| inline static

Definition at line 601 of file bignum.c.

References BDIGIT_DBL.

static size_t integer_unpack_num_bdigits | ( | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int * | nlp_bits_ret
| ) |  |
| static

Definition at line 1028 of file bignum.c.

References assert, BITSPERDIG, CHAR_BIT, integer_unpack_num_bdigits_generic(), integer_unpack_num_bdigits_small(), and SIZE_MAX.

Referenced by bary_unpack(), and rb_integer_unpack().

static size_t integer_unpack_num_bdigits_generic | ( | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int * | nlp_bits_ret
| ) |  |
| static

Definition at line 968 of file bignum.c.

References BITSPERDIG, and CHAR_BIT.

Referenced by integer_unpack_num_bdigits().

static size_t integer_unpack_num_bdigits_small | ( | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int * | nlp_bits_ret
| ) |  |
| static

Definition at line 958 of file bignum.c.

References BITSPERDIG, and CHAR_BIT.

Referenced by integer_unpack_num_bdigits().

static void integer_unpack_push_bits | ( | int | data,
|  | int | numbits,
|  | BDIGIT_DBL * | ddp,
|  | int * | numbits_in_dd_p,
|  | BDIGIT ** | dpp
| ) |  |
| inline static

Definition at line 1050 of file bignum.c.

References BDIGIT_DBL, BIGDN, BIGLO, and BITSPERDIG.

static int integer_unpack_single_bdigit | ( | BDIGIT | u,
|  | size_t | size,
|  | int | flags,
|  | BDIGIT * | dp
| ) |  |
| static

Definition at line 1062 of file bignum.c.

References BDIGMAX, BIGLO, CHAR_BIT, INTEGER_PACK_2COMP, INTEGER_PACK_NEGATIVE, LSHIFTX, and SIZEOF_BDIGITS.

Referenced by bary_unpack_internal().

static BDIGIT_DBL maxpow_in_bdigit_dbl | ( | int | base,
|  | int * | exp_ret
| ) |  |
| static

Definition at line 325 of file bignum.c.

References assert, BDIGIT_DBL, and BDIGIT_DBL_MAX.

Referenced by big2str_generic(), power_cache_get_power(), rb_cstr_to_inum(), rb_str2big_karatsuba(), and rb_str2big_normal().

static int nlz | ( | BDIGIT | x | ) |
| static

Definition at line 159 of file bignum.c.

References CHAR_BIT, nlz_int(), and SIZEOF_BDIGITS.

Referenced by bary_divmod_normal(), big2dbl(), big2str_karatsuba(), big_fdiv(), big_fdiv_int(), and rb_absint_size().

static VALUE power_cache_get_power | ( | int | base,
|  | int | power_level,
|  | size_t * | numdigits_ret
| ) |  |
| inline static

Definition at line 4499 of file bignum.c.

References BDIGIT_DBL, bdigitdbl2bary(), BDIGITS, bignew, bigsq(), bigtrunc(), MAX_BASE36_POWER_TABLE_ENTRIES, maxpow_in_bdigit_dbl(), NIL_P, rb_bug(), rb_gc_register_mark_object(), and rb_obj_hide().

Referenced by big2str_generic(), big2str_karatsuba(), and str2big_karatsuba().

static void power_cache_init | ( | void |  | ) |
| static

Definition at line 4488 of file bignum.c.

References MAX_BASE36_POWER_TABLE_ENTRIES, and Qnil.

Referenced by Init_Bignum().

size_t rb_absint_numwords | ( | VALUE | val,
|  | size_t | word_numbits,
|  | size_t * | nlz_bits_ret
| ) |  |

Definition at line 3366 of file bignum.c.

References absint_numwords_generic(), absint_numwords_small(), assert, CHAR_BIT, rb_absint_size(), and SIZE_MAX.

Referenced by big2str_base_poweroftwo(), limited_big_rand(), math_log(), math_log10(), math_log2(), rand_init(), rb_big_pow(), and rb_str_format().

int rb_absint_singlebit_p | ( | VALUE | val | ) |

Definition at line 3430 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, dp, FIX2LONG, FIXNUM_P, numberof, POW2_P, rb_to_int(), and RBIGNUM_LEN.

Referenced by rb_big_bit_length(), and rb_str_format().

size_t rb_absint_size | ( | VALUE | val,
|  | int * | nlz_bits_ret
| ) |  |

Definition at line 3231 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, CHAR_BIT, dp, FIX2LONG, FIXNUM_P, nlz(), numberof, rb_to_int(), RBIGNUM_LEN, and SIZEOF_BDIGITS.

Referenced by rb_absint_numwords(), rb_big_bit_length(), rb_num_to_uint(), and v2w().

double rb_big2dbl | ( | VALUE | x | ) |

Definition at line 5269 of file bignum.c.

References big2dbl(), isinf(), and rb_warning().

Referenced by flo_div(), flo_divmod(), flo_minus(), flo_mod(), flo_mul(), flo_plus(), flo_pow(), ole_val2ptr_variant(), ole_val2variant(), rb_big_divide(), rb_big_fdiv(), rb_big_minus(), rb_big_mul(), rb_big_plus(), rb_big_pow(), rb_big_to_f(), and rb_Float().

SIGNED_VALUE rb_big2long | ( | VALUE | x | ) |

Definition at line 5101 of file bignum.c.

References big2ulong(), LONG_MAX, LONG_MIN, rb_eRangeError, rb_raise(), and RBIGNUM_POSITIVE_P.

Referenced by rb_num2long().

VALUE rb_big2str | ( | VALUE | x,
|  | int | base
| ) |  |

Definition at line 5014 of file bignum.c.

References rb_big2str1().

Referenced by GetVpValueWithPrec(), rb_big_to_s(), and rb_str_format().

VALUE rb_big2str0 | ( | VALUE | x,
|  | int | base,
|  | int | trim
| ) |  |

Definition at line 4980 of file bignum.c.

References big2str_find_n1(), BIGZEROP, FIXNUM_P, MEMMOVE, rb_big2str1(), rb_str_resize(), RSTRING_LEN, and RSTRING_PTR.

static VALUE rb_big2str1 | ( | VALUE | x,
|  | int | base
| ) |  |
| static

Definition at line 4939 of file bignum.c.

References BARY_TRUNC, BDIGIT, BDIGITS, big2str_base_poweroftwo(), big2str_generic(), bigtrunc(), BITSPERDIG, FIXNUM_P, GMP_BIG2STR_DIGITS, LONG_MAX, POW2_P, rb_eArgError, rb_eRangeError, rb_fix2str(), rb_raise(), rb_usascii_str_new2, and RBIGNUM_LEN.

Referenced by rb_big2str(), and rb_big2str0().

VALUE rb_big2str_generic | ( | VALUE | x,
|  | int | base
| ) |  |

Definition at line 4892 of file bignum.c.

References big2str_generic().

VALUE rb_big2str_poweroftwo | ( | VALUE | x,
|  | int | base
| ) |  |

Definition at line 4809 of file bignum.c.

References big2str_base_poweroftwo().

VALUE rb_big2ulong | ( | VALUE | x | ) |

Definition at line 5084 of file bignum.c.

References big2ulong(), LONG_MAX, LONG_MIN, rb_eRangeError, rb_raise(), and RBIGNUM_POSITIVE_P.

Referenced by rb_num2ulong_internal(), and rb_num_to_uint().

VALUE rb_big2ulong_pack | ( | VALUE | x | ) |

Definition at line 5075 of file bignum.c.

References INTEGER_PACK_2COMP, INTEGER_PACK_NATIVE_BYTE_ORDER, and rb_integer_pack().

void rb_big_2comp | ( | VALUE | x | ) |

Definition at line 3033 of file bignum.c.

References get2comp().

static VALUE rb_big_abs | ( | VALUE | x | ) |
| static

Definition at line 6940 of file bignum.c.

References rb_big_clone(), RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.

Referenced by Init_Bignum().

VALUE rb_big_and | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6479 of file bignum.c.

References abs2twocomp(), BDIGIT, BDIGITS, bigand_int(), bignew, bignorm(), FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, RB_GC_GUARD, rb_num_coerce_bit(), and twocomp2abs_bang().

Referenced by fix_and(), and Init_Bignum().

static VALUE rb_big_aref | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 6847 of file bignum.c.

References BDIGIT, BDIGITS, big2ulong(), BIGSIZE, bigtrunc(), BITSPERDIG, INT2FIX, NUM2LONG, RB_BIGNUM_TYPE_P, RBIGNUM_LEN, RBIGNUM_POSITIVE_P, RBIGNUM_SIGN, and shift().

Referenced by Init_Bignum().

static VALUE rb_big_bit_length | ( | VALUE | big | ) |
| static

Definition at line 6999 of file bignum.c.

References BARY_ARGS, BARY_SHORT_MUL, BARY_SUB, bary_unpack(), BDIGIT, bdigit_roomof, CHAR_BIT, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, LONG2FIX, numberof, rb_absint_singlebit_p(), rb_absint_size(), rb_integer_unpack(), RBIGNUM_NEGATIVE_P, SIZE_MAX, and SIZET2NUM.

Referenced by Init_Bignum().

VALUE rb_big_clone | ( | VALUE | x | ) |

Definition at line 3004 of file bignum.c.

References BDIGIT, BDIGITS, bignew_1(), CLASS_OF, MEMCPY, RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by rb_big_abs(), rb_big_neg(), and rb_big_uminus().

VALUE rb_big_cmp | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5393 of file bignum.c.

References bary_cmp(), BDIGITS, cmp, FIX2LONG, FIXNUM_P, INT2FIX, RB_BIGNUM_TYPE_P, RB_FLOAT_TYPE_P, rb_int2big(), rb_integer_float_cmp(), rb_intern, rb_num_coerce_cmp(), RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by big_op(), fix_cmp(), fix_ge(), fix_gt(), fix_le(), fix_lt(), Init_Bignum(), and rb_integer_float_cmp().

static VALUE rb_big_coerce | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 6917 of file bignum.c.

References FIX2LONG, FIXNUM_P, rb_assoc_new(), RB_BIGNUM_TYPE_P, rb_eTypeError, rb_int2big(), rb_obj_classname(), and rb_raise().

Referenced by Init_Bignum().

VALUE rb_big_div | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6161 of file bignum.c.

References rb_big_divide().

Referenced by fix_divide(), and Init_Bignum().

static VALUE rb_big_divide | ( | VALUE | x,
|  | VALUE | y,
|  | ID | op
| ) |  |
| static

Definition at line 6124 of file bignum.c.

References bigdivmod(), bignorm(), DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, rb_dbl2big(), RB_FLOAT_TYPE_P, rb_int2big(), rb_num_coerce_bin(), rb_num_zerodiv(), and RFLOAT_VALUE.

Referenced by rb_big_div(), and rb_big_idiv().

VALUE rb_big_divmod | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6237 of file bignum.c.

References bigdivmod(), bignorm(), div, FIX2LONG, FIXNUM_P, mod, rb_assoc_new(), RB_BIGNUM_TYPE_P, rb_int2big(), rb_intern, and rb_num_coerce_bin().

Referenced by fix_divmod(), and Init_Bignum().

VALUE rb_big_divrem_normal | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 2698 of file bignum.c.

References bary_divmod_normal(), BARY_TRUNC, BDIGIT, BDIGITS, BIGDIVREM_EXTRA_WORDS, bignew, bigtrunc(), LONG2FIX, rb_assoc_new(), RB_GC_GUARD, rb_num_zerodiv(), RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::yn.

VALUE rb_big_eq | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5529 of file bignum.c.

References BDIGIT, BDIGITS, bignorm(), FIX2LONG, FIXNUM_P, MEMCMP, Qfalse, Qtrue, RB_BIGNUM_TYPE_P, rb_equal(), RB_FLOAT_TYPE_P, rb_int2big(), rb_integer_float_eq(), RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by fix_equal(), Init_Bignum(), and rb_integer_float_eq().

VALUE rb_big_eql | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5561 of file bignum.c.

References BDIGIT, BDIGITS, MEMCMP, Qfalse, Qtrue, RB_BIGNUM_TYPE_P, RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by Init_Bignum().

static VALUE rb_big_even_p | ( | VALUE | num | ) |
| static

Definition at line 7063 of file bignum.c.

References BDIGITS, Qfalse, Qtrue, and RBIGNUM_LEN.

Referenced by Init_Bignum().

VALUE rb_big_fdiv | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6321 of file bignum.c.

References big2dbl(), big_fdiv_float(), big_fdiv_int(), DBL2NUM, FIX2LONG, FIXNUM_P, isinf(), isnan, rb_big2dbl(), RB_BIGNUM_TYPE_P, RB_FLOAT_TYPE_P, rb_int2big(), rb_intern, rb_num_coerce_bin(), and RFLOAT_VALUE.

Referenced by fix_fdiv(), and Init_Bignum().

static VALUE rb_big_hash | ( | VALUE | x | ) |
| static

Definition at line 6894 of file bignum.c.

References BDIGIT, BDIGITS, hash(), INT2FIX, rb_memhash(), RBIGNUM_LEN, and RBIGNUM_SIGN.

Referenced by Init_Bignum().

VALUE rb_big_idiv | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6174 of file bignum.c.

References rb_big_divide(), and rb_intern.

Referenced by Init_Bignum().

VALUE rb_big_lshift | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6760 of file bignum.c.

References big_shift2(), big_shift3(), bignorm(), bit_length, BITSPERDIG, FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, rb_to_int(), and shift().

Referenced by fix_lshift(), Init_Bignum(), and rb_fix_lshift().

VALUE rb_big_minus | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5903 of file bignum.c.

References bigadd(), bigadd_int(), bignorm(), bigsub_int(), DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, RB_FLOAT_TYPE_P, rb_num_coerce_bin(), RBIGNUM_SIGN, and RFLOAT_VALUE.

Referenced by fix_minus(), Init_Bignum(), rand_int(), rand_range(), rb_int_pred(), sub(), and wsub().

VALUE rb_big_modulo | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6189 of file bignum.c.

References bigdivmod(), bignorm(), FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, rb_int2big(), and rb_num_coerce_bin().

Referenced by fix_mod(), Init_Bignum(), and mod().

VALUE rb_big_mul | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5997 of file bignum.c.

References bigmul0(), bignorm(), DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, RB_FLOAT_TYPE_P, rb_int2big(), rb_num_coerce_bin(), and RFLOAT_VALUE.

Referenced by f_imul(), fix_mul(), Init_Bignum(), int_pair_to_real_inclusive(), int_pow(), mul(), and wmul().

VALUE rb_big_mul_balance | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 1668 of file bignum.c.

References bary_mul_balance_with_mulfunc(), BDIGITS, bignew, NULL, RB_GC_GUARD, RBIGNUM_LEN, and RBIGNUM_SIGN.

VALUE rb_big_mul_karatsuba | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 1849 of file bignum.c.

References bary_mul_karatsuba(), BDIGITS, bignew, KARATSUBA_BALANCED, NULL, rb_eArgError, RB_GC_GUARD, rb_raise(), RBIGNUM_LEN, and RBIGNUM_SIGN.

VALUE rb_big_mul_normal | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 1540 of file bignum.c.

References bary_mul_normal(), BDIGITS, bignew, RB_GC_GUARD, RBIGNUM_LEN, and RBIGNUM_SIGN.

VALUE rb_big_mul_toom3 | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 2246 of file bignum.c.

References bary_mul_toom3(), BDIGITS, bignew, NULL, rb_eArgError, RB_GC_GUARD, rb_raise(), RBIGNUM_LEN, RBIGNUM_SIGN, and TOOM3_BALANCED.

static VALUE rb_big_neg | ( | VALUE | x | ) |
| static

Definition at line 5600 of file bignum.c.

References bary_add_one(), bary_neg(), BDIGIT, BDIGITS, big_extend_carry(), bignorm(), INT2FIX, rb_big_clone(), RBIGNUM_LEN, RBIGNUM_POSITIVE_P, RBIGNUM_SET_NEGATIVE_SIGN, and RBIGNUM_SET_POSITIVE_SIGN.

Referenced by Init_Bignum().

VALUE rb_big_new | ( | long | len,
|  | int | sign
| ) |  |

Definition at line 2998 of file bignum.c.

References bignew.

VALUE rb_big_norm | ( | VALUE | x | ) |

Definition at line 3136 of file bignum.c.

References bignorm().

Referenced by fix_aref(), and rand_range().

static VALUE rb_big_odd_p | ( | VALUE | num | ) |
| static

Definition at line 7047 of file bignum.c.

References BDIGITS, Qfalse, Qtrue, and RBIGNUM_LEN.

Referenced by Init_Bignum().

VALUE rb_big_or | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6605 of file bignum.c.

References abs2twocomp(), BDIGIT, BDIGITS, bignew, bignorm(), bigor_int(), FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, RB_GC_GUARD, rb_num_coerce_bit(), and twocomp2abs_bang().

Referenced by fix_or(), and Init_Bignum().

void rb_big_pack | ( | VALUE | val,
|  | unsigned long * | buf,
|  | long | num_longs
| ) |  |

Definition at line 3199 of file bignum.c.

References INTEGER_PACK_2COMP, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, and rb_integer_pack().

Referenced by is_even(), and rb_dlcfunc_call().

VALUE rb_big_plus | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5867 of file bignum.c.

References bigadd(), bigadd_int(), bignorm(), bigsub_int(), DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, RB_FLOAT_TYPE_P, rb_num_coerce_bin(), RBIGNUM_SIGN, and RFLOAT_VALUE.

Referenced by add(), fix_plus(), Init_Bignum(), rand_range(), rb_int_succ(), rb_random_int32(), ulong_to_num_plus_1(), and wadd().

VALUE rb_big_pow | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6363 of file bignum.c.

References bigmul0(), bignorm(), bigsq(), bigtrunc(), BIGZEROP, DBL2NUM, FIX2LONG, FIXNUM_MAX, FIXNUM_P, INT2FIX, NULL, rb_absint_numwords(), rb_big2dbl(), RB_BIGNUM_TYPE_P, rb_complex_raw1, RB_FLOAT_TYPE_P, rb_funcall(), rb_intern, rb_num_coerce_bin(), rb_rational_raw1, rb_warn(), RBIGNUM_SIGN, RFLOAT_VALUE, round(), and SIGNED_VALUE.

Referenced by fix_pow(), Init_Bignum(), and int_pow().

static void rb_big_realloc | ( | VALUE | big,
|  | long | len
| ) |  |
| static

Definition at line 2938 of file bignum.c.

References ALLOC_N, BDIGIT, MEMCPY, RBASIC, RBIGNUM, RBIGNUM_EMBED_FLAG, RBIGNUM_EMBED_LEN_MAX, RBIGNUM_LEN, RBIGNUM_SET_LEN, REALLOC_N, VALGRIND_MAKE_MEM_UNDEFINED, and xfree().

Referenced by rb_big_resize().

static VALUE rb_big_remainder | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 6214 of file bignum.c.

References bigdivrem(), bignorm(), FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, rb_int2big(), rb_intern, and rb_num_coerce_bin().

Referenced by Init_Bignum().

void rb_big_resize | ( | VALUE | big,
|  | long | len
| ) |  |

Definition at line 2973 of file bignum.c.

References rb_big_realloc(), and RBIGNUM_SET_LEN.

Referenced by big_extend_carry(), bigfixize(), and bigtrunc().

VALUE rb_big_rshift | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6798 of file bignum.c.

References big_shift2(), big_shift3(), bignorm(), bit_length, BITSPERDIG, FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, rb_to_int(), and shift().

Referenced by Init_Bignum(), math_log(), math_log10(), math_log2(), and rb_fix_rshift().

static VALUE rb_big_size | ( | VALUE | big | ) |
| static

Definition at line 6962 of file bignum.c.

References BIGSIZE, and SIZET2NUM.

Referenced by Init_Bignum().

VALUE rb_big_sq_fast | ( | VALUE | x | ) |

Definition at line 1609 of file bignum.c.

References bary_sq_fast(), BDIGITS, bignew, RB_GC_GUARD, and RBIGNUM_LEN.

static void rb_big_stop | ( | void * | ptr | ) |
| static

Definition at line 2560 of file bignum.c.

References Qtrue, and big_div_struct::stop.

Referenced by bigdivrem_restoring().

static VALUE rb_big_to_f | ( | VALUE | x | ) |
| static

Definition at line 5293 of file bignum.c.

References DBL2NUM, and rb_big2dbl().

Referenced by Init_Bignum().

static VALUE rb_big_to_s | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | x
| ) |  |
| static

Definition at line 5034 of file bignum.c.

References big2str_struct::base, NUM2INT, rb_big2str(), and rb_scan_args().

Referenced by Init_Bignum().

VALUE rb_big_uminus | ( | VALUE | x | ) |

Definition at line 5578 of file bignum.c.

References bignorm(), rb_big_clone(), RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.

Referenced by Init_Bignum(), and rand_int().

VALUE rb_big_unpack | ( | unsigned long * | buf,
|  | long | num_longs
| ) |  |

Definition at line 3207 of file bignum.c.

References INTEGER_PACK_2COMP, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, and rb_integer_unpack().

VALUE rb_big_xor | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6705 of file bignum.c.

References abs2twocomp(), BDIGIT, BDIGITS, bignew, bignorm(), bigxor_int(), FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, RB_GC_GUARD, rb_num_coerce_bit(), and twocomp2abs_bang().

Referenced by fix_xor(), and Init_Bignum().

int rb_bigzero_p | ( | VALUE | x | ) |

Definition at line 2903 of file bignum.c.

References BIGZEROP.

Referenced by rand_int(), and rand_range().

int rb_cmpint | ( | VALUE | val,
|  | VALUE | a,
|  | VALUE | b
| ) |  |

Definition at line 2909 of file bignum.c.

References BIGZEROP, FIX2LONG, FIXNUM_P, INT2FIX, NIL_P, RB_BIGNUM_TYPE_P, rb_cmperr(), rb_funcall(), RBIGNUM_SIGN, and RTEST.

Referenced by cmp(), cmp_eq(), cmp_ge(), cmp_gt(), cmp_le(), cmp_lt(), enum_each_cons_size(), flo_cmp(), max_by_i(), max_i(), max_ii(), min_by_i(), min_i(), min_ii(), minmax_by_i(), minmax_by_i_update(), minmax_i(), minmax_i_update(), minmax_ii(), minmax_ii_update(), r_le(), r_lt(), range_bsearch(), range_max(), range_min(), rb_ary_bsearch(), rb_invcmp(), ruby_num_interval_step_size(), sort_1(), sort_2(), sort_by_cmp(), and wcmp().

VALUE rb_cstr2inum | ( | const char * | str,
|  | int | base
| ) |  |

Definition at line 4373 of file bignum.c.

References rb_cstr_to_inum().

Referenced by JSON_parse_integer().

VALUE rb_cstr_to_inum | ( | const char * | str,
|  | int | base,
|  | int | badcheck
| ) |  |

Definition at line 3963 of file bignum.c.

References bad, bignorm(), bit_length, CHAR_BIT, conv_digit, GMP_STR2BIG_DIGITS, INT2FIX, ISSPACE, KARATSUBA_MUL_DIGITS, LONG2FIX, maxpow_in_bdigit_dbl(), POSFIXABLE, POW2_P, rb_eArgError, rb_invalid_str(), rb_raise(), rb_uint2big(), RBIGNUM_SET_SIGN, result, roomof, str2big_karatsuba(), str2big_normal(), str2big_poweroftwo(), str2big_scan_digits(), strlen(), STRTOUL, and val.

Referenced by asn1integer_to_num(), ossl_bn_to_i(), parser_yylex(), rb_cstr2inum(), rb_str_to_inum(), read_digits(), str2num(), and tkstr_to_int().

VALUE rb_dbl2big | ( | double | d | ) |

Definition at line 5213 of file bignum.c.

References bignorm(), and dbl2big().

Referenced by BigDecimal_power(), case_when_optimizable_literal(), dbl2ival(), fix_divide(), flo_ceil(), flo_floor(), flo_truncate(), float_decode_internal(), rb_big_divide(), rb_convert_to_integer(), rb_integer_float_cmp(), rb_integer_float_eq(), rb_str_format(), and ruby_num_interval_step_size().

VALUE rb_int2big | ( | SIGNED_VALUE | n | ) |

Definition at line 3164 of file bignum.c.

References neg, rb_uint2big(), and RBIGNUM_SET_SIGN.

Referenced by bigdivmod(), bigdivrem(), f_imul(), fix_cmp(), fix_divide(), fix_divmod(), fix_fdiv(), fix_ge(), fix_gt(), fix_le(), fix_lshift(), fix_lt(), fix_minus(), fix_mod(), fix_mul(), fix_pow(), int_pow(), rb_big_cmp(), rb_big_coerce(), rb_big_divide(), rb_big_divmod(), rb_big_eq(), rb_big_fdiv(), rb_big_modulo(), rb_big_mul(), rb_big_remainder(), rb_fix_lshift(), rb_fix_rshift(), rb_int2inum(), rb_int2num_inline(), rb_long2num_inline(), and w_object().

VALUE rb_int2inum | ( | SIGNED_VALUE | n | ) |

Definition at line 3192 of file bignum.c.

References FIXABLE, LONG2FIX, and rb_int2big().

Referenced by gzfile_reader_rewind().

VALUE rb_integer_float_cmp | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5299 of file bignum.c.

References FIX2LONG, FIXNUM_MAX, FIXNUM_MIN, FIXNUM_P, INT2FIX, isinf(), isnan, Qnil, rb_big_cmp(), rb_dbl2big(), and RFLOAT_VALUE.

Referenced by big_op(), fix_cmp(), fix_ge(), fix_gt(), fix_le(), fix_lt(), flo_cmp(), flo_ge(), flo_gt(), flo_le(), flo_lt(), and rb_big_cmp().

VALUE rb_integer_float_eq | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5349 of file bignum.c.

References FIX2LONG, FIXNUM_P, isinf(), isnan, LONG_MAX, LONG_MIN, Qfalse, Qtrue, rb_big_eq(), rb_dbl2big(), and RFLOAT_VALUE.

Referenced by fix_equal(), flo_eq(), and rb_big_eq().

int rb_integer_pack | ( | VALUE | val,
|  | void * | words,
|  | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags
| ) |  |

Definition at line 3531 of file bignum.c.

References bary_pack(), BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, FIX2LONG, FIXNUM_P, numberof, RB_GC_GUARD, rb_to_int(), RBIGNUM_LEN, and RBIGNUM_POSITIVE_P.

Referenced by big2str_base_poweroftwo(), big_shift2(), int_pair_to_real_inclusive(), limited_big_rand(), rand_init(), random_load(), rb_big2ulong_pack(), rb_big_pack(), rb_hash(), rb_quad_pack(), and rb_str_format().

VALUE rb_integer_unpack | ( | const void * | words,
|  | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags
| ) |  |

Definition at line 3617 of file bignum.c.

References bary_unpack_internal(), bary_zero_p(), BDIGIT, BDIGIT_DBL, BDIGIT_DBL_SIGNED, BDIGIT_MSB, BDIGITS, big_extend_carry(), bignew, bignorm(), bigtrunc(), BIGUP, INTEGER_PACK_2COMP, INTEGER_PACK_FORCE_BIGNUM, INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION, INTEGER_PACK_LSBYTE_FIRST, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_MSBYTE_FIRST, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, INTEGER_PACK_NEGATIVE, integer_unpack_num_bdigits(), LONG2FIX, LONG_MAX, MEMCPY, NEGFIXABLE, numberof, POSFIXABLE, Qfalse, rb_eArgError, rb_raise(), RBIGNUM_LEN, RBIGNUM_SET_SIGN, val, and validate_integer_pack_format().

Referenced by int_pair_to_real_inclusive(), limited_big_rand(), make_seed_value(), mt_state(), pack_unpack(), r_object0(), rb_big_bit_length(), rb_big_unpack(), and rb_quad_unpack().

void rb_quad_pack | ( | char * | buf,
|  | VALUE | val
| ) |  |

Definition at line 3691 of file bignum.c.

References INTEGER_PACK_2COMP, INTEGER_PACK_NATIVE_BYTE_ORDER, QUAD_SIZE, and rb_integer_pack().

VALUE rb_quad_unpack | ( | const char * | buf,
|  | int | signed_p
| ) |  |

Definition at line 3699 of file bignum.c.

References INTEGER_PACK_2COMP, INTEGER_PACK_NATIVE_BYTE_ORDER, QUAD_SIZE, and rb_integer_unpack().

VALUE rb_str2big_karatsuba | ( | VALUE | arg,
|  | int | base,
|  | int | badcheck
| ) |  |

Definition at line 4233 of file bignum.c.

References bignorm(), maxpow_in_bdigit_dbl(), rb_eArgError, RB_GC_GUARD, rb_must_asciicompat(), rb_raise(), roomof, str2big_karatsuba(), str2big_scan_digits(), and StringValueCStr.

VALUE rb_str2big_normal | ( | VALUE | arg,
|  | int | base,
|  | int | badcheck
| ) |  |

Definition at line 4194 of file bignum.c.

References bignorm(), maxpow_in_bdigit_dbl(), rb_eArgError, RB_GC_GUARD, rb_must_asciicompat(), rb_raise(), roomof, str2big_normal(), str2big_scan_digits(), and StringValueCStr.

VALUE rb_str2big_poweroftwo | ( | VALUE | arg,
|  | int | base,
|  | int | badcheck
| ) |  |

Definition at line 4161 of file bignum.c.

References bignorm(), bit_length, POW2_P, rb_eArgError, RB_GC_GUARD, rb_must_asciicompat(), rb_raise(), str2big_poweroftwo(), str2big_scan_digits(), and StringValueCStr.

VALUE rb_str2inum | ( | VALUE | str,
|  | int | base
| ) |  |

Definition at line 4379 of file bignum.c.

References rb_str_to_inum().

VALUE rb_str_to_inum | ( | VALUE | str,
|  | int | base,
|  | int | badcheck
| ) |  |

Definition at line 4129 of file bignum.c.

References ALLOCV, ALLOCV_END, MEMCPY, rb_cstr_to_inum(), rb_must_asciicompat(), RSTRING_LEN, RSTRING_PTR, StringValue, and StringValueCStr.

Referenced by fun1(), obj2int(), obj2subsecx(), obj2vint(), rb_convert_to_integer(), rb_str2inum(), rb_str_format(), rb_str_hex(), rb_str_oct(), rb_str_to_i(), rb_str_upto(), and usec2subsecx().

VALUE rb_uint2big | ( | VALUE | n | ) |

Definition at line 3142 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, bignew, RBIGNUM_SET_LEN, and SIZEOF_VALUE.

Referenced by bigdivrem(), rb_cstr_to_inum(), rb_int2big(), rb_uint2inum(), rb_uint2num_inline(), and rb_ulong2num_inline().

VALUE rb_uint2inum | ( | VALUE | n | ) |

Definition at line 3185 of file bignum.c.

References LONG2FIX, POSFIXABLE, and rb_uint2big().

Referenced by do_checksum(), rb_gzfile_crc(), rb_gzfile_total_in(), rb_gzfile_total_out(), rb_zlib_crc_table(), rb_zstream_adler(), rb_zstream_avail_out(), rb_zstream_total_in(), rb_zstream_total_out(), and zstream_run().

STATIC_ASSERT | ( | sizeof_bdigit_dbl | ,
|  | sizeof(BDIGIT_DBL) | = `=SIZEOF_BDIGIT_DBL`
| ) |  |

STATIC_ASSERT | ( | sizeof_bdigit_dbl_signed | ,
|  | sizeof(BDIGIT_DBL_SIGNED) | = `=SIZEOF_BDIGIT_DBL`
| ) |  |

STATIC_ASSERT | ( | sizeof_bdigit | ,
|  | SIZEOF_BDIGITS<= | sizeofBDIGIT
| ) |  |

STATIC_ASSERT | ( | sizeof_bdigit_and_dbl | ,
|  | SIZEOF_BDIGITS *2<= | SIZEOF_BDIGIT_DBL
| ) |  |

STATIC_ASSERT | ( | bdigit_signedness |  | ) |

STATIC_ASSERT | ( | bdigit_dbl_signedness |  | ) |

STATIC_ASSERT | ( | bdigit_dbl_signed_signedness | ,
|  | 0 | ,
|  | (BDIGIT_DBL_SIGNED)- | 1
| ) |  |

STATIC_ASSERT | ( | rbignum_embed_len_max | ,
|  | RBIGNUM_EMBED_LEN_MAX<= | RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT
| ) |  |

STATIC_ASSERT | ( | sizeof_long_and_sizeof_bdigit | ,
|  | SIZEOF_BDIGITS% | SIZEOF_LONG = `=0`
| ) |  |

static VALUE str2big_karatsuba | ( | int | sign,
|  | const char * | digits_start,
|  | const char * | digits_end,
|  | size_t | num_digits,
|  | size_t | num_bdigits,
|  | int | digits_per_bdigits_dbl,
|  | int | base
| ) |  |
| static

Definition at line 3836 of file bignum.c.

References ALLOCV_END, ALLOCV_N, assert, bary_add(), bary_mul(), BARY_TRUNC, BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, conv_digit, MEMCPY, NULL, power_cache_get_power(), and RBIGNUM_LEN.

Referenced by rb_cstr_to_inum(), and rb_str2big_karatsuba().

static VALUE str2big_normal | ( | int | sign,
|  | const char * | digits_start,
|  | const char * | digits_end,
|  | size_t | num_bdigits,
|  | int | base
| ) |  |
| static

Definition at line 3792 of file bignum.c.

References assert, BDIGIT, BDIGIT_DBL, BDIGITS, BDIGITS_ZERO, BIGDN, BIGLO, bignew, conv_digit, and big_div_struct::zds.

Referenced by rb_cstr_to_inum(), and rb_str2big_normal().

static VALUE str2big_poweroftwo | ( | int | sign,
|  | const char * | digits_start,
|  | const char * | digits_end,
|  | size_t | num_digits,
|  | int | bits_per_digit
| ) |  |
| static

Definition at line 3751 of file bignum.c.

References assert, BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, BITSPERDIG, conv_digit, dp, and roomof.

Referenced by rb_cstr_to_inum(), and rb_str2big_poweroftwo().

static void str2big_scan_digits | ( | const char * | s,
|  | const char * | str,
|  | int | base,
|  | int | badcheck,
|  | size_t * | num_digits_p,
|  | size_t * | len_p
| ) |  |
| static

Definition at line 3709 of file bignum.c.

References bad, conv_digit, ISSPACE, and rb_invalid_str().

Referenced by rb_cstr_to_inum(), rb_str2big_karatsuba(), rb_str2big_normal(), and rb_str2big_poweroftwo().

static void twocomp2abs_bang | ( | VALUE | x,
|  | int | hibits
| ) |  |
| static

Definition at line 3060 of file bignum.c.

References get2comp(), and RBIGNUM_SET_SIGN.

Referenced by big_shift3(), bigand_int(), bigor_int(), bigxor_int(), rb_big_and(), rb_big_or(), and rb_big_xor().

static void validate_integer_pack_format | ( | size_t | numwords,
|  | size_t | wordsize,
|  | size_t | nails,
|  | int | flags,
|  | int | supported_flags
| ) |  |
| static

Definition at line 490 of file bignum.c.

References CHAR_BIT, INTEGER_PACK_BYTEORDER_MASK, INTEGER_PACK_LSBYTE_FIRST, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_MSBYTE_FIRST, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, INTEGER_PACK_WORDORDER_MASK, PRI_SIZE_PREFIX, rb_eArgError, rb_raise(), SIZE_MAX, and SSIZE_MAX.

Referenced by bary_pack(), bary_unpack(), and rb_integer_unpack().

## Variable Documentation

mulfunc_t bary_mul_karatsuba_start
| static

Definition at line 145 of file bignum.c.

Referenced by bary_mul_karatsuba().

mulfunc_t bary_mul_toom3_start
| static

Definition at line 144 of file bignum.c.

Referenced by bary_mul(), and bary_mul_toom3().

size_t base36_numdigits_cache[35][MAX_BASE36_POWER_TABLE_ENTRIES]
| static

Definition at line 4485 of file bignum.c.

VALUE base36_power_cache[35][MAX_BASE36_POWER_TABLE_ENTRIES]
| static

Definition at line 4484 of file bignum.c.

VALUE rb_cBignum

Definition at line 35 of file bignum.c.

Referenced by generate_json(), Init_Bignum(), Init_RandomSeed2(), k_bignum_p(), negative_int_p(), positive_int_p(), and vm_redefinition_check_flag().

const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz"

Definition at line 36 of file bignum.c.

Referenced by big2str_2bdigits(), big2str_base_poweroftwo(), rb_fix2str(), and rb_str_format().