Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
Public APIs related to so-called rb_cBignum. More...
#include "ruby/internal/config.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
#include "ruby/backward/2/long_long.h"
Go to the source code of this file.
Macros | |
#define | rb_big2int(x) rb_big2long(x) |
#define | rb_big2uint(x) rb_big2ulong(x) |
#define | INTEGER_PACK_MSWORD_FIRST 0x01 |
#define | INTEGER_PACK_LSWORD_FIRST 0x02 |
#define | INTEGER_PACK_MSBYTE_FIRST 0x10 |
#define | INTEGER_PACK_LSBYTE_FIRST 0x20 |
#define | INTEGER_PACK_NATIVE_BYTE_ORDER 0x40 |
#define | INTEGER_PACK_2COMP 0x80 |
#define | INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION 0x400 |
#define | INTEGER_PACK_FORCE_BIGNUM 0x100 |
#define | INTEGER_PACK_NEGATIVE 0x200 |
#define | INTEGER_PACK_LITTLE_ENDIAN |
#define | INTEGER_PACK_BIG_ENDIAN |
Public APIs related to so-called rb_cBignum.
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file bignum.h.
#define INTEGER_PACK_BIG_ENDIAN |
#define INTEGER_PACK_LITTLE_ENDIAN |
#define rb_big2int | ( | x | ) | rb_big2long(x) |
#define rb_big2uint | ( | x | ) | rb_big2ulong(x) |
size_t rb_absint_numwords | ( | VALUE | val, |
size_t | word_numbits, | ||
size_t * | nlz_bits_ret | ||
) |
Definition at line 3388 of file bignum.c.
References assert, CHAR_BIT, rb_absint_size(), and SIZE_MAX.
Referenced by rb_big_pow(), and rb_str_format().
Definition at line 3452 of file bignum.c.
References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, dp, FIX2LONG, FIXNUM_P, numberof, POW2_P, and rb_to_int().
Referenced by rb_big_bit_length(), and rb_str_format().
Definition at line 3253 of file bignum.c.
References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, CHAR_BIT, dp, FIX2LONG, FIXNUM_P, numberof, rb_to_int(), and SIZEOF_BDIGIT.
Referenced by rb_absint_numwords(), rb_big_bit_length(), and rb_num_to_uint().
double rb_big2dbl | ( | VALUE | x | ) |
Definition at line 5309 of file bignum.c.
References HUGE_VAL, isinf(), and rb_warning().
Referenced by ole_val2variant(), rb_big_minus(), rb_big_mul(), rb_big_plus(), rb_big_pow(), rb_float_div(), rb_float_minus(), rb_float_mul(), rb_float_plus(), and rb_float_pow().
Definition at line 5139 of file bignum.c.
References long(), LONG_MAX, LONG_MIN, num, rb_eRangeError, and rb_raise().
Referenced by rb_num2long().
Definition at line 5090 of file bignum.c.
References big2str_struct::base.
Referenced by rb_int2str(), and rb_str_format().
Definition at line 5124 of file bignum.c.
References long(), LONG_MIN, num, rb_eRangeError, and rb_raise().
Referenced by rb_num_to_uint().
Definition at line 6357 of file bignum.c.
References BDIGIT, BDIGITS, bignew, FIX2LONG, FIXNUM_P, RB_GC_GUARD, RB_INTEGER_TYPE_P, and rb_num_coerce_bit().
Referenced by rb_int_and().
Definition at line 3026 of file bignum.c.
References BDIGIT, BDIGITS, CLASS_OF, len, and MEMCPY.
Referenced by rb_big_abs(), rb_big_comp(), and rb_big_uminus().
Definition at line 5416 of file bignum.c.
References BDIGITS, FIXNUM_P, idCmp, INT2FIX, RB_BIGNUM_TYPE_P, rb_integer_float_cmp(), rb_num_coerce_cmp(), and SIGNED_VALUE.
Referenced by rb_int_cmp(), and rb_integer_float_cmp().
Definition at line 6088 of file bignum.c.
Referenced by rb_int_div().
Definition at line 6132 of file bignum.c.
References div, FIX2LONG, FIXNUM_P, mod, rb_assoc_new(), RB_BIGNUM_TYPE_P, rb_int2big(), and rb_num_coerce_bin().
Referenced by rb_int_divmod().
Definition at line 5521 of file bignum.c.
References BDIGIT, BDIGITS, FIXNUM_P, MEMCMP, Qfalse, Qtrue, RB_BIGNUM_TYPE_P, rb_equal(), and rb_integer_float_eq().
Referenced by rb_int_equal(), and rb_integer_float_eq().
Definition at line 6094 of file bignum.c.
Referenced by rb_int_idiv().
Definition at line 6618 of file bignum.c.
References bit_length, BITSPERDIG, FIX2LONG, FIXNUM_P, int(), long(), RB_BIGNUM_TYPE_P, and rb_to_int().
Referenced by rb_int_lshift().
Definition at line 5850 of file bignum.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, rb_num_coerce_bin(), and RFLOAT_VALUE.
Referenced by rb_int_minus().
Definition at line 6100 of file bignum.c.
References FIX2LONG, FIXNUM_P, RB_BIGNUM_TYPE_P, rb_int2big(), and rb_num_coerce_bin().
Referenced by rb_int_modulo().
Definition at line 5930 of file bignum.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, rb_int2big(), rb_num_coerce_bin(), and RFLOAT_VALUE.
Referenced by rb_int_mul().
Definition at line 3158 of file bignum.c.
Referenced by rb_fix_aref().
Definition at line 6476 of file bignum.c.
References BDIGIT, BDIGITS, bignew, FIX2LONG, FIXNUM_P, RB_GC_GUARD, RB_INTEGER_TYPE_P, and rb_num_coerce_bit().
Definition at line 3221 of file bignum.c.
References INTEGER_PACK_2COMP, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, and rb_integer_pack().
Definition at line 5821 of file bignum.c.
References DBL2NUM, FIX2LONG, FIXNUM_P, rb_big2dbl(), RB_BIGNUM_TYPE_P, rb_num_coerce_bin(), and RFLOAT_VALUE.
Referenced by rb_int_plus(), and rb_int_succ().
Definition at line 6241 of file bignum.c.
References BIGZEROP, DBL2NUM, FIX2LONG, FIXNUM_MAX, FIXNUM_P, idPow, INT2FIX, LONG2NUM, mask, NULL, NUM2DBL, rb_absint_numwords(), rb_big2dbl(), rb_big_pow(), RB_BIGNUM_TYPE_P, rb_dbl_complex_new_polar_pi(), RB_INTEGER_TYPE_P, rb_num_coerce_bin(), rb_rational_raw(), rb_warn(), RFLOAT_VALUE, and SIGNED_VALUE.
Referenced by rb_big_pow(), and rb_int_pow().
void rb_big_resize | ( | VALUE | big, |
size_t | len | ||
) |
Definition at line 2994 of file bignum.c.
References BIGNUM_SET_LEN, and len.
Definition at line 6648 of file bignum.c.
References bit_length, BITSPERDIG, FIX2LONG, FIXNUM_P, int(), long(), RB_BIGNUM_TYPE_P, and rb_to_int().
Definition at line 3229 of file bignum.c.
References INTEGER_PACK_2COMP, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, and rb_integer_unpack().
Definition at line 6570 of file bignum.c.
References BDIGIT, BDIGITS, bignew, FIX2LONG, FIXNUM_P, RB_GC_GUARD, RB_INTEGER_TYPE_P, and rb_num_coerce_bit().
Definition at line 4544 of file bignum.c.
References rb_cstr_to_inum(), and str.
Definition at line 4016 of file bignum.c.
References INT2FIX, NIL_P, NULL, rb_invalid_str(), and str.
Referenced by rb_cstr2inum().
VALUE rb_dbl2big | ( | double | d | ) |
Definition at line 5248 of file bignum.c.
Referenced by rb_integer_float_cmp(), rb_integer_float_eq(), rb_node_case_when_optimizable_literal(), rb_str_format(), and ruby_num_interval_step_size().
int rb_integer_pack | ( | VALUE | val, |
void * | words, | ||
size_t | numwords, | ||
size_t | wordsize, | ||
size_t | nails, | ||
int | flags | ||
) |
Definition at line 3553 of file bignum.c.
References BDIGIT, bdigit_roomof, BDIGITS, BIGDN, BIGLO, FIX2LONG, FIXNUM_P, numberof, RB_GC_GUARD, and rb_to_int().
Referenced by rb_big_pack(), rb_hash(), 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 3639 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGIT_DBL_SIGNED, BDIGIT_MSB, BDIGITS, bignew, 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, LONG2FIX, LONG_MAX, MEMCPY, NEGFIXABLE, numberof, POSFIXABLE, Qfalse, rb_eArgError, and rb_raise().
Referenced by rb_big_bit_length(), and rb_big_unpack().
Definition at line 4550 of file bignum.c.
References rb_str_to_inum(), and str.
Definition at line 4274 of file bignum.c.
References rb_str_convert_to_inum(), str, and TRUE.
Referenced by rb_str2inum(), rb_str_format(), rb_str_upto_each(), and rb_str_upto_endless_each().
Definition at line 1660 of file pack.c.
References castchar, Qnil, rb_eRangeError, rb_raise(), and UNREACHABLE_RETURN.