Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
bignum.c File Reference
`#include "internal.h"`
`#include "ruby/thread.h"`
`#include "ruby/util.h"`
`#include "id.h"`
`#include <math.h>`
`#include <float.h>`
`#include <ctype.h>`
`#include "ruby_assert.h"`

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 | 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) (BIGNUM_DIGITS(x))
#define | BITSPERDIG (SIZEOF_BDIGIT*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 | bdigit_roomof(n) roomof(n, SIZEOF_BDIGIT)
#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 | BIGNUM_SET_NEGATIVE_SIGN(b) BIGNUM_SET_SIGN(b, 0)
#define | BIGNUM_SET_POSITIVE_SIGN(b) BIGNUM_SET_SIGN(b, 1)
#define | bignew(len, sign) bignew_1(rb_cInteger,(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 | NAIVE_MUL_DIGITS KARATSUBA_MUL_DIGITS
#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 | reinterpret_cast(type, value) (type)value
#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 | BIGNUM_SET_LEN(b, l)
#define | conv_digit(c) (ruby_digit36_to_number_table[(unsigned char)(c)])
#define | ADV(n)
#define | ASSERT_LEN()
#define | MAX_BASE36_POWER_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)
#define | rb_bdigit_dbl_isqrt(x) (BDIGIT)rb_ulong_isqrt(x)
#define | BDIGIT_DBL_TO_DOUBLE(n) (double)(n)
#define | MUL_MODULO(a, b, c) rb_int_modulo(rb_fix_mul_fix((a), (b)), (c))

## 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 }
enum | { DBL_BIGDIG = ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG) }

## 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_BDIGIT<=sizeof(BDIGIT))
| STATIC_ASSERT (sizeof_bdigit_and_dbl, SIZEOF_BDIGIT *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, BIGNUM_EMBED_LEN_MAX<=(BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT))
| STATIC_ASSERT (sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG==0)
VALUE | rb_big_mul_normal (VALUE x, VALUE y)
VALUE | rb_big_sq_fast (VALUE x)
VALUE | rb_big_mul_balance (VALUE x, VALUE y)
VALUE | rb_big_mul_karatsuba (VALUE x, VALUE y)
VALUE | rb_big_mul_toom3 (VALUE x, VALUE y)
VALUE | rb_big_divrem_normal (VALUE x, VALUE y)
int | rb_bigzero_p (VALUE x)
int | rb_cmpint (VALUE val, VALUE a, VALUE b)
void | rb_big_resize (VALUE big, size_t len)
VALUE | rb_big_new (size_t len, int sign)
VALUE | rb_big_clone (VALUE x)
void | rb_big_2comp (VALUE x)
VALUE | rb_big_norm (VALUE x)
VALUE | rb_uint2big (uintptr_t n)
VALUE | rb_int2big (intptr_t n)
VALUE | rb_uint2inum (uintptr_t n)
VALUE | rb_int2inum (intptr_t 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)
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)
| NORETURN (static inline void invalid_radix(int base))
| NORETURN (static inline void invalid_integer(VALUE s))
VALUE | rb_cstr_to_inum (const char *str, int base, int badcheck)
VALUE | rb_int_parse_cstr (const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags)
VALUE | rb_str_convert_to_inum (VALUE str, int base, int badcheck, int raise_exception)
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)
VALUE | rb_big2str_poweroftwo (VALUE x, int base)
VALUE | rb_big2str_generic (VALUE x, int base)
VALUE | rb_big2str (VALUE x, int base)
unsigned long | rb_big2ulong (VALUE x)
long | rb_big2long (VALUE x)
VALUE | rb_dbl2big (double d)
double | rb_big2dbl (VALUE x)
VALUE | rb_integer_float_cmp (VALUE x, VALUE y)
COMPILER_WARNING_POP VALUE | rb_integer_float_eq (VALUE x, VALUE y)
VALUE | rb_big_cmp (VALUE x, VALUE y)
VALUE | rb_big_gt (VALUE x, VALUE y)
VALUE | rb_big_ge (VALUE x, VALUE y)
VALUE | rb_big_lt (VALUE x, VALUE y)
VALUE | rb_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)
VALUE | rb_big_comp (VALUE x)
VALUE | rb_big_plus (VALUE x, VALUE y)
VALUE | rb_big_minus (VALUE x, VALUE y)
VALUE | rb_big_mul (VALUE x, VALUE y)
VALUE | rb_big_div (VALUE x, VALUE y)
VALUE | rb_big_idiv (VALUE x, VALUE y)
VALUE | rb_big_modulo (VALUE x, VALUE y)
VALUE | rb_big_remainder (VALUE x, VALUE y)
VALUE | rb_big_divmod (VALUE x, VALUE y)
double | rb_big_fdiv_double (VALUE x, VALUE y)
VALUE | rb_big_fdiv (VALUE x, VALUE y)
VALUE | rb_big_pow (VALUE x, VALUE y)
VALUE | rb_big_and (VALUE x, VALUE y)
VALUE | rb_big_or (VALUE x, VALUE 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)
VALUE | rb_big_aref (VALUE x, VALUE y)
VALUE | rb_big_hash (VALUE x)
VALUE | rb_big_abs (VALUE x)
int | rb_big_sign (VALUE x)
size_t | rb_big_size (VALUE big)
VALUE | rb_big_size_m (VALUE big)
VALUE | rb_big_bit_length (VALUE big)
VALUE | rb_big_odd_p (VALUE num)
VALUE | rb_big_even_p (VALUE num)
unsigned long | rb_ulong_isqrt (unsigned long)
VALUE | rb_big_isqrt (VALUE n)
VALUE | rb_int_powm (int const argc, VALUE *const argv, VALUE const num)
void | Init_Bignum (void)

## Variables
const char | ruby_digitmap [] = "0123456789abcdefghijklmnopqrstuvwxyz"

## Macro Definition Documentation

## ◆ ADV

#define ADV | ( |  | n | ) |

Value:
do {\
if (len > 0 && len <= (n)) goto bad; \
str += (n); \
len -= (n); \
} while (0)

## ◆ ASSERT_LEN

#define ASSERT_LEN | ( |  | ) |

Value:
do {\
assert(len != 0); \
if (len0 >= 0) assert(s + len0 == str + len); \
} while (0)

## ◆ BARY_ADD

#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.

## ◆ BARY_ARGS

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

Definition at line 104 of file bignum.c.

## ◆ BARY_DIVMOD

#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.

## ◆ BARY_SHORT_MUL

#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.

## ◆ BARY_SUB

#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.

## ◆ BARY_TRUNC

#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.

## ◆ BARY_ZERO_P

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

Definition at line 110 of file bignum.c.

## ◆ BDIGIT_DBL_MAX

#define BDIGIT_DBL_MAX (~(BDIGIT_DBL)0)

Definition at line 84 of file bignum.c.

## ◆ BDIGIT_DBL_TO_DOUBLE

#define BDIGIT_DBL_TO_DOUBLE | ( |  | n | ) | (double)(n)

Definition at line 6858 of file bignum.c.

## ◆ BDIGIT_MSB

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

Definition at line 79 of file bignum.c.

## ◆ bdigit_roomof

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

Definition at line 103 of file bignum.c.

## ◆ BDIGITS

#define BDIGITS | ( |  | x | ) | (BIGNUM_DIGITS(x))

Definition at line 75 of file bignum.c.

## ◆ BDIGITS_ZERO

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

Definition at line 117 of file bignum.c.

## ◆ BDIGMAX

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

Definition at line 83 of file bignum.c.

## ◆ BIGDIVREM_EXTRA_WORDS

#define BIGDIVREM_EXTRA_WORDS 1

Definition at line 102 of file bignum.c.

## ◆ BIGDN

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

Definition at line 81 of file bignum.c.

## ◆ BIGLO

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

Definition at line 82 of file bignum.c.

## ◆ bignew

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

Definition at line 115 of file bignum.c.

## ◆ BIGNUM_DEBUG

#define BIGNUM_DEBUG 0

Definition at line 2887 of file bignum.c.

## ◆ BIGNUM_SET_LEN

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

Value:
((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
(void)(RBASIC(b)->flags = \
(RBASIC(b)->flags & ~BIGNUM_EMBED_LEN_MASK) | \
((l) << BIGNUM_EMBED_LEN_SHIFT)) : \
(void)(RBIGNUM(b)->as.heap.len = (l)))

Definition at line 2946 of file bignum.c.

## ◆ BIGNUM_SET_NEGATIVE_SIGN

#define BIGNUM_SET_NEGATIVE_SIGN | ( |  | b | ) | BIGNUM_SET_SIGN(b, 0)

Definition at line 112 of file bignum.c.

## ◆ BIGNUM_SET_POSITIVE_SIGN

#define BIGNUM_SET_POSITIVE_SIGN | ( |  | b | ) | BIGNUM_SET_SIGN(b, 1)

Definition at line 113 of file bignum.c.

## ◆ BIGRAD

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

Definition at line 77 of file bignum.c.

## ◆ BIGRAD_HALF

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

Definition at line 78 of file bignum.c.

## ◆ BIGSIZE

#define BIGSIZE | ( |  | x | ) |

Value:
(BIGNUM_LEN(x) == 0 ? (size_t)0 : \
BDIGITS(x)[BIGNUM_LEN(x)-1] ? \
(size_t)(BIGNUM_LEN(x)*SIZEOF_BDIGIT - nlz(BDIGITS(x)[BIGNUM_LEN(x)-1])/CHAR_BIT) : \
rb_absint_size(x, NULL))

Definition at line 97 of file bignum.c.

## ◆ BIGUP

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

Definition at line 80 of file bignum.c.

## ◆ BIGZEROP

#define BIGZEROP | ( |  | x | ) |

Value:
(BIGNUM_LEN(x) == 0 || \
(BDIGITS(x)[0] == 0 && \
(BIGNUM_LEN(x) == 1 || bigzero_p(x))))

Definition at line 94 of file bignum.c.

## ◆ BITSPERDIG

#define BITSPERDIG (SIZEOF_BDIGIT*CHAR_BIT)

Definition at line 76 of file bignum.c.

## ◆ CLEAR_LOWBITS

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

Definition at line 71 of file bignum.c.

## ◆ conv_digit

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

Definition at line 3704 of file bignum.c.

## ◆ FILL_DD

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

## ◆ FILL_LOWBITS

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

Definition at line 72 of file bignum.c.

## ◆ GMP_BIG2STR_DIGITS

#define GMP_BIG2STR_DIGITS 20

Definition at line 139 of file bignum.c.

## ◆ GMP_DIV_DIGITS

#define GMP_DIV_DIGITS 20

Definition at line 138 of file bignum.c.

## ◆ GMP_MUL_DIGITS

#define GMP_MUL_DIGITS 20

Definition at line 134 of file bignum.c.

## ◆ GMP_STR2BIG_DIGITS

#define GMP_STR2BIG_DIGITS 20

Definition at line 140 of file bignum.c.

## ◆ HOST_BIGENDIAN_P

#define HOST_BIGENDIAN_P 0

Definition at line 66 of file bignum.c.

## ◆ INTEGER_PACK_BYTEORDER_MASK

#define INTEGER_PACK_BYTEORDER_MASK

Value:
(INTEGER_PACK_MSBYTE_FIRST | \
INTEGER_PACK_LSBYTE_FIRST | \
INTEGER_PACK_NATIVE_BYTE_ORDER)

Definition at line 492 of file bignum.c.

## ◆ INTEGER_PACK_WORDORDER_MASK

#define INTEGER_PACK_WORDORDER_MASK

Value:
(INTEGER_PACK_MSWORD_FIRST | \
INTEGER_PACK_LSWORD_FIRST)

Definition at line 489 of file bignum.c.

## ◆ KARATSUBA_BALANCED

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

Definition at line 131 of file bignum.c.

## ◆ KARATSUBA_MUL_DIGITS

#define KARATSUBA_MUL_DIGITS 70

Definition at line 135 of file bignum.c.

## ◆ LSHIFTABLE

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

Definition at line 69 of file bignum.c.

## ◆ LSHIFTX

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

Definition at line 70 of file bignum.c.

## ◆ MAX_BASE36_POWER_TABLE_ENTRIES

#define MAX_BASE36_POWER_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)

Definition at line 4647 of file bignum.c.

## ◆ MUL_MODULO

#define MUL_MODULO | ( |  | a,
|  |  | b,
|  |  | c
| ) |  | rb_int_modulo(rb_fix_mul_fix((a), (b)), (c))

## ◆ NAIVE_MUL_DIGITS

#define NAIVE_MUL_DIGITS KARATSUBA_MUL_DIGITS

Definition at line 144 of file bignum.c.

## ◆ ON_DEBUG

#define ON_DEBUG | ( |  | x | ) |

Definition at line 2909 of file bignum.c.

## ◆ POW2_P

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

Definition at line 73 of file bignum.c.

## ◆ PUSH_BITS

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

## ◆ rb_bdigit_dbl_isqrt

#define rb_bdigit_dbl_isqrt | ( |  | x | ) | (BDIGIT)rb_ulong_isqrt(x)

Definition at line 6855 of file bignum.c.

## ◆ RB_BIGNUM_TYPE_P

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

Definition at line 33 of file bignum.c.

## ◆ reinterpret_cast

#define reinterpret_cast | ( |  | type,
|  |  | value
| ) |  | (type)value

Definition at line 1094 of file bignum.c.

## ◆ SIZEOF_BDIGIT_DBL

#define SIZEOF_BDIGIT_DBL SIZEOF_LONG_LONG

Definition at line 42 of file bignum.c.

## ◆ TAKE_LOWBITS

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

## ◆ TOOM3_BALANCED

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

Definition at line 132 of file bignum.c.

## ◆ TOOM3_MUL_DIGITS

#define TOOM3_MUL_DIGITS 150

Definition at line 136 of file bignum.c.

## ◆ U16

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

Definition at line 173 of file bignum.c.

## ◆ U32

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

Definition at line 174 of file bignum.c.

## Typedef Documentation

## ◆ mulfunc_t

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 147 of file bignum.c.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
DBL_BIGDIG |

Definition at line 6160 of file bignum.c.

## ◆ big_op_t

enum big_op_t

Enumerator
big_op_gt |
big_op_ge |
big_op_lt |
big_op_le |

Definition at line 5446 of file bignum.c.

## Function Documentation

## ◆ Init_Bignum()

void Init_Bignum | ( | void |  | ) |

Definition at line 7177 of file bignum.c.

References rb_cBignum, rb_cInteger, rb_cObject, rb_define_const(), rb_define_method(), and rb_deprecate_constant().

## ◆ NORETURN() [1/2]

NORETURN | ( | static inline void | invalid_integerVALUE s | ) |

## ◆ NORETURN() [2/2]

NORETURN | ( | static inline void | invalid_radixint base | ) |

## ◆ rb_absint_numwords()

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

Definition at line 3382 of file bignum.c.

References CHAR_BIT, rb_absint_size(), and SIZE_MAX.

## ◆ rb_absint_singlebit_p()

int rb_absint_singlebit_p | ( | VALUE | val | ) |

Definition at line 3446 of file bignum.c.

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

Referenced by rb_big_bit_length().

## ◆ rb_absint_size()

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

Definition at line 3247 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, BIGNUM_LEN, dp, FIX2LONG, FIXNUM_P, i, numberof, rb_to_int(), and v.

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

## ◆ rb_big2dbl()

double rb_big2dbl | ( | VALUE | x | ) |

Definition at line 5310 of file bignum.c.

Referenced by rb_big_mul(), rb_big_pow(), rb_float_div(), rb_float_mul(), rb_float_plus(), and rb_float_pow().

## ◆ rb_big2long()

long rb_big2long | ( | VALUE | x | ) |

Definition at line 5140 of file bignum.c.

Referenced by rb_num2long().

## ◆ rb_big2str()

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

Definition at line 5091 of file bignum.c.

Referenced by rb_int2str().

## ◆ rb_big2str_generic()

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

Definition at line 5004 of file bignum.c.

## ◆ rb_big2str_poweroftwo()

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

Definition at line 4921 of file bignum.c.

## ◆ rb_big2ulong()

unsigned long rb_big2ulong | ( | VALUE | x | ) |

Definition at line 5125 of file bignum.c.

Referenced by rb_num_to_uint().

## ◆ rb_big_2comp()

void rb_big_2comp | ( | VALUE | x | ) |

Definition at line 3049 of file bignum.c.

## ◆ rb_big_abs()

VALUE rb_big_abs | ( | VALUE | x | ) |

Definition at line 6762 of file bignum.c.

References BIGNUM_NEGATIVE_P, BIGNUM_SET_POSITIVE_SIGN, and rb_big_clone().

## ◆ rb_big_and()

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

Definition at line 6360 of file bignum.c.

References BDIGIT, i, RB_INTEGER_TYPE_P, rb_num_coerce_bit(), and yn().

## ◆ rb_big_aref()

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

Definition at line 6681 of file bignum.c.

References BDIGIT.

## ◆ rb_big_bit_length()

VALUE rb_big_bit_length | ( | VALUE | big | ) |

Definition at line 6790 of file bignum.c.

References BDIGIT, bdigit_roomof, BIGNUM_NEGATIVE_P, CHAR_BIT, LONG2FIX, rb_absint_singlebit_p(), rb_absint_size(), SIZE_MAX, and SIZET2NUM.

## ◆ rb_big_clone()

VALUE rb_big_clone | ( | VALUE | x | ) |

Definition at line 3020 of file bignum.c.

References BIGNUM_LEN, and len.

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

## ◆ rb_big_cmp()

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

Definition at line 5419 of file bignum.c.

References FIXNUM_P.

Referenced by rb_integer_float_cmp().

## ◆ rb_big_comp()

VALUE rb_big_comp | ( | VALUE | x | ) |

Definition at line 5564 of file bignum.c.

References BDIGIT, BDIGITS, BIGNUM_LEN, BIGNUM_POSITIVE_P, INT2FIX, n, and rb_big_clone().

## ◆ rb_big_div()

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

Definition at line 6091 of file bignum.c.

## ◆ rb_big_divmod()

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

Definition at line 6135 of file bignum.c.

References div(), FIX2LONG, FIXNUM_P, idDivmod, mod, RB_BIGNUM_TYPE_P, rb_int2big(), and rb_num_coerce_bin().

## ◆ rb_big_divrem_normal()

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

Definition at line 2714 of file bignum.c.

References BARY_TRUNC, BDIGIT, BDIGITS, BIGDIVREM_EXTRA_WORDS, bignew, BIGNUM_LEN, BIGNUM_SIGN, LONG2FIX, rb_assoc_new(), rb_num_zerodiv(), big_div_struct::yds, and yn().

## ◆ rb_big_eq()

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

Definition at line 5524 of file bignum.c.

References FIXNUM_P.

## ◆ rb_big_eql()

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

Definition at line 5544 of file bignum.c.

References BDIGIT, BDIGITS, BIGNUM_LEN, BIGNUM_SIGN, MEMCMP, Qfalse, Qtrue, and RB_BIGNUM_TYPE_P.

## ◆ rb_big_even_p()

VALUE rb_big_even_p | ( | VALUE | num | ) |

Definition at line 6840 of file bignum.c.

References BDIGITS, BIGNUM_LEN, Qfalse, and Qtrue.

## ◆ rb_big_fdiv()

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

Definition at line 6238 of file bignum.c.

References DBL2NUM, and rb_big_fdiv_double().

## ◆ rb_big_fdiv_double()

double rb_big_fdiv_double | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 6209 of file bignum.c.

References v.

Referenced by rb_big_fdiv().

## ◆ rb_big_ge()

VALUE rb_big_ge | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5495 of file bignum.c.

## ◆ rb_big_gt()

VALUE rb_big_gt | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5489 of file bignum.c.

## ◆ rb_big_hash()

VALUE rb_big_hash | ( | VALUE | x | ) |

Definition at line 6726 of file bignum.c.

## ◆ rb_big_idiv()

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

Definition at line 6097 of file bignum.c.

## ◆ rb_big_isqrt()

VALUE rb_big_isqrt | ( | VALUE | n | ) |

Definition at line 6911 of file bignum.c.

References BDIGIT, BDIGITS, BIGNUM_LEN, len, n, and rb_bdigit_dbl_isqrt.

## ◆ rb_big_le()

VALUE rb_big_le | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5507 of file bignum.c.

## ◆ rb_big_lshift()

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

Definition at line 6621 of file bignum.c.

References FIX2LONG, and FIXNUM_P.

## ◆ rb_big_lt()

VALUE rb_big_lt | ( | VALUE | x,
|  | VALUE | y
| ) |  |

Definition at line 5501 of file bignum.c.

## ◆ rb_big_minus()

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

Definition at line 5853 of file bignum.c.

References BIGNUM_SIGN, FIX2LONG, FIXNUM_P, and n.

## ◆ rb_big_modulo()

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

Definition at line 6103 of file bignum.c.

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

## ◆ rb_big_mul()

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

Definition at line 5933 of file bignum.c.

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

## ◆ rb_big_mul_balance()

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

Definition at line 1689 of file bignum.c.

References bignew, BIGNUM_LEN, BIGNUM_SIGN, and yn().

## ◆ rb_big_mul_karatsuba()

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

Definition at line 1870 of file bignum.c.

References bignew, BIGNUM_LEN, BIGNUM_SIGN, KARATSUBA_BALANCED, rb_eArgError, rb_raise(), and yn().

## ◆ rb_big_mul_normal()

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

Definition at line 1561 of file bignum.c.

References bignew, BIGNUM_LEN, BIGNUM_SIGN, and yn().

## ◆ rb_big_mul_toom3()

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

Definition at line 2267 of file bignum.c.

References bignew, BIGNUM_LEN, BIGNUM_SIGN, rb_eArgError, rb_raise(), TOOM3_BALANCED, and yn().

## ◆ rb_big_new()

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

Definition at line 3014 of file bignum.c.

References bignew, and len.

## ◆ rb_big_norm()

VALUE rb_big_norm | ( | VALUE | x | ) |

Definition at line 3152 of file bignum.c.

Referenced by rb_fix_aref().

## ◆ rb_big_odd_p()

VALUE rb_big_odd_p | ( | VALUE | num | ) |

Definition at line 6831 of file bignum.c.

References BDIGITS, BIGNUM_LEN, Qfalse, and Qtrue.

Referenced by rb_int_odd_p().

## ◆ rb_big_or()

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

Definition at line 6479 of file bignum.c.

References BDIGIT, i, RB_INTEGER_TYPE_P, rb_num_coerce_bit(), and yn().

## ◆ rb_big_pack()

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

Definition at line 3215 of file bignum.c.

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

## ◆ rb_big_plus()

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

Definition at line 5824 of file bignum.c.

References BIGNUM_SIGN, FIX2LONG, FIXNUM_P, and n.

Referenced by rb_int_succ().

## ◆ rb_big_pow()

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

Definition at line 6244 of file bignum.c.

References BIGNUM_NEGATIVE_P, BIGZEROP, INT2FIX, pow(), rb_big2dbl(), RB_BIGNUM_TYPE_P, rb_dbl_complex_new_polar_pi(), RB_FLOAT_TYPE_P, RFLOAT_VALUE, and SIGNED_VALUE.

## ◆ rb_big_remainder()

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

Definition at line 6119 of file bignum.c.

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

## ◆ rb_big_resize()

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

Definition at line 2989 of file bignum.c.

## ◆ rb_big_rshift()

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

Definition at line 6651 of file bignum.c.

References FIX2LONG, and FIXNUM_P.

## ◆ rb_big_sign()

int rb_big_sign | ( | VALUE | x | ) |

Definition at line 6772 of file bignum.c.

References BIGNUM_SIGN.

## ◆ rb_big_size()

size_t rb_big_size | ( | VALUE | big | ) |

Definition at line 6778 of file bignum.c.

References BIGSIZE.

Referenced by rb_big_size_m().

## ◆ rb_big_size_m()

VALUE rb_big_size_m | ( | VALUE | big | ) |

Definition at line 6784 of file bignum.c.

References rb_big_size(), and SIZET2NUM.

## ◆ rb_big_sq_fast()

VALUE rb_big_sq_fast | ( | VALUE | x | ) |

Definition at line 1630 of file bignum.c.

References bignew, and BIGNUM_LEN.

## ◆ rb_big_uminus()

VALUE rb_big_uminus | ( | VALUE | x | ) |

Definition at line 5554 of file bignum.c.

References BIGNUM_NEGATE, and rb_big_clone().

## ◆ rb_big_unpack()

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

Definition at line 3223 of file bignum.c.

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

## ◆ rb_big_xor()

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

Definition at line 6573 of file bignum.c.

References BDIGIT, i, RB_INTEGER_TYPE_P, rb_num_coerce_bit(), and yn().

## ◆ rb_bigzero_p()

int rb_bigzero_p | ( | VALUE | x | ) |

Definition at line 2919 of file bignum.c.

References BIGZEROP.

## ◆ rb_cmpint()

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

Definition at line 2925 of file bignum.c.

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

## ◆ rb_cstr2inum()

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

Definition at line 4538 of file bignum.c.

References rb_cstr_to_inum(), and str.

## ◆ rb_cstr_to_inum()

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

Definition at line 4012 of file bignum.c.

Referenced by rb_cstr2inum().

## ◆ rb_dbl2big()

VALUE rb_dbl2big | ( | double | d | ) |

Definition at line 5249 of file bignum.c.

Referenced by rb_integer_float_cmp(), and rb_node_case_when_optimizable_literal().

## ◆ rb_int2big()

VALUE rb_int2big | ( | intptr_t | n | ) |

Definition at line 3180 of file bignum.c.

References BIGNUM_SET_NEGATIVE_SIGN, n, neg, and rb_uint2big().

Referenced by rb_big_divmod(), rb_big_modulo(), rb_big_mul(), rb_big_remainder(), and rb_int2inum().

## ◆ rb_int2inum()

VALUE rb_int2inum | ( | intptr_t | n | ) |

Definition at line 3208 of file bignum.c.

References FIXABLE, LONG2FIX, n, and rb_int2big().

## ◆ rb_int_parse_cstr()

VALUE rb_int_parse_cstr | ( | const char * | str,
|  | ssize_t | len,
|  | char ** | endp,
|  | size_t * | ndigits,
|  | int | base,
|  | int | flags
| ) |  |

Definition at line 4041 of file bignum.c.

References ADV, ASSERT_LEN, bad, ISSPACE, len, Qnil, RB_INT_PARSE_PREFIX, RB_INT_PARSE_SIGN, and str.

## ◆ rb_int_powm()

VALUE rb_int_powm | ( | int const | argc,
|  | VALUE *const | argv,
|  | VALUE const | num
| ) |  |

Definition at line 7112 of file bignum.c.

References argc, argv, FIX2LONG, FIXNUM_P, HALF_LONG_MSB, long, rb_check_arity, rb_eRangeError, rb_eTypeError, rb_int_negative_p(), rb_int_pow(), rb_int_uminus(), RB_INTEGER_TYPE_P, rb_num_zerodiv(), and rb_raise().

## ◆ rb_integer_float_cmp()

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

Definition at line 5325 of file bignum.c.

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

Referenced by rb_float_gt().

## ◆ rb_integer_float_eq()

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

Definition at line 5386 of file bignum.c.

References double, FIX2LONG, FIXNUM_P, isinf, isnan, LONG_MIN, modf(), Qfalse, Qtrue, RFLOAT_VALUE, and yn().

Referenced by rb_float_equal().

## ◆ rb_integer_pack()

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

Definition at line 3547 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, BIGNUM_LEN, BIGNUM_POSITIVE_P, FIX2LONG, FIXNUM_P, i, numberof, RB_GC_GUARD, rb_to_int(), and v.

Referenced by rb_big_pack().

## ◆ rb_integer_unpack()

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

Definition at line 3633 of file bignum.c.

References BDIGIT.

Referenced by rb_big_unpack().

## ◆ rb_str2big_karatsuba()

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

Definition at line 4352 of file bignum.c.

References len, and str.

## ◆ rb_str2big_normal()

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

Definition at line 4310 of file bignum.c.

References len, and str.

## ◆ rb_str2big_poweroftwo()

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

Definition at line 4274 of file bignum.c.

References len, and str.

## ◆ rb_str2inum()

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

Definition at line 4544 of file bignum.c.

References rb_str_to_inum(), and str.

## ◆ rb_str_convert_to_inum()

VALUE rb_str_convert_to_inum | ( | VALUE | str,
|  | int | base,
|  | int | badcheck,
|  | int | raise_exception
| ) |  |

Definition at line 4246 of file bignum.c.

References len, rb_must_asciicompat(), RSTRING_GETMEM, str, and StringValue().

Referenced by rb_str_to_inum().

## ◆ rb_str_to_inum()

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

Definition at line 4268 of file bignum.c.

References rb_str_convert_to_inum(), str, and TRUE.

Referenced by rb_str2inum().

## ◆ rb_uint2big()

VALUE rb_uint2big | ( | uintptr_t | n | ) |

Definition at line 3158 of file bignum.c.

References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, bignew, BIGNUM_SET_LEN, i, n, and SIZEOF_VALUE.

Referenced by rb_int2big(), and rb_uint2inum().

## ◆ rb_uint2inum()

VALUE rb_uint2inum | ( | uintptr_t | n | ) |

Definition at line 3201 of file bignum.c.

References LONG2FIX, n, POSFIXABLE, and rb_uint2big().

## ◆ rb_ulong_isqrt()

unsigned long rb_ulong_isqrt | ( | unsigned long |  | ) |

## ◆ STATIC_ASSERT() [1/9]

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

## ◆ STATIC_ASSERT() [2/9]

STATIC_ASSERT | ( | bdigit_dbl_signedness |  | ) |

## ◆ STATIC_ASSERT() [3/9]

STATIC_ASSERT | ( | bdigit_signedness |  | ) |

## ◆ STATIC_ASSERT() [4/9]

STATIC_ASSERT | ( | rbignum_embed_len_max | ,
|  | BIGNUM_EMBED_LEN_MAX<= | BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT
| ) |  |

## ◆ STATIC_ASSERT() [5/9]

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

## ◆ STATIC_ASSERT() [6/9]

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

## ◆ STATIC_ASSERT() [7/9]

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

## ◆ STATIC_ASSERT() [8/9]

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

## ◆ STATIC_ASSERT() [9/9]

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

## Variable Documentation

## ◆ ruby_digitmap

const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz"

Definition at line 38 of file bignum.c.

Referenced by rb_fix2str().

void
void
Definition: rb_mjit_min_header-2.7.0.h:13273
assert
#define assert(x)
Definition: dlmalloc.c:1176
size_t
long unsigned int size_t
Definition: rb_mjit_min_header-2.7.0.h:666
BIGNUM_EMBED_LEN_MASK
#define BIGNUM_EMBED_LEN_MASK
Definition: internal.h:770
CHAR_BIT
#define CHAR_BIT
Definition: ruby.h:227
ptr
struct RIMemo * ptr
Definition: debug.c:74
NULL
#define NULL
Definition: _sdbm.c:101
SIZEOF_BDIGIT
#define SIZEOF_BDIGIT
Definition: internal.h:689
INTEGER_PACK_MSWORD_FIRST
#define INTEGER_PACK_MSWORD_FIRST
Definition: intern.h:151
RBIGNUM
#define RBIGNUM(obj)
Definition: internal.h:786
BIGNUM_EMBED_LEN_SHIFT
#define BIGNUM_EMBED_LEN_SHIFT
Definition: internal.h:772
INTEGER_PACK_MSBYTE_FIRST
#define INTEGER_PACK_MSBYTE_FIRST
Definition: intern.h:153
bad
#define bad(x)
Definition: _sdbm.c:123
BDIGITS
#define BDIGITS(x)
Definition: bignum.c:75
n
const char size_t n
Definition: rb_mjit_min_header-2.7.0.h:5456
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
BIGNUM_EMBED_FLAG
#define BIGNUM_EMBED_FLAG
Definition: internal.h:769
RBASIC
#define RBASIC(obj)
Definition: ruby.h:1267
len
uint8_t len
Definition: escape.c:17
rb_absint_size
size_t rb_absint_size(VALUE val, int *nlz_bits_ret)
Definition: bignum.c:3247
BIGNUM_LEN
#define BIGNUM_LEN(b)
Definition: internal.h:774