Ruby
1.9.3p429(2013-05-15revision40747)
|
#include "ruby/ruby.h"
#include "ruby/util.h"
#include "internal.h"
#include <math.h>
#include <float.h>
#include <ctype.h>
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | big_div_struct |
Macros | |
#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 | DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS) |
#define | BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG) |
#define | BIGDN(x) RSHIFT((x),BITSPERDIG) |
#define | BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1))) |
#define | BDIGMAX ((BDIGIT)-1) |
#define | BIGZEROP(x) |
#define | BIGNUM_DEBUG 0 |
#define | ON_DEBUG(x) |
#define | RBIGNUM_SET_LEN(b, l) |
#define | bignew(len, sign) bignew_1(rb_cBignum,(len),(sign)) |
#define | QUAD_SIZE 8 |
#define | BNEG(b) (RSHIFT(((BDIGIT*)(b))[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0) |
#define | ISDIGIT(c) ('0' <= (c) && (c) <= '9') |
#define | conv_digit(c) |
#define | POW2_P(x) (((x)&((x)-1))==0) |
#define | MASK_55 0x55555555UL |
#define | MASK_33 0x33333333UL |
#define | MASK_0f 0x0f0f0f0fUL |
#define | LOG2_KARATSUBA_DIGITS 7 |
#define | KARATSUBA_DIGITS (1L<<LOG2_KARATSUBA_DIGITS) |
#define | MAX_BIG2STR_TABLE_ENTRIES 64 |
#define | KARATSUBA_MUL_DIGITS 70 |
#define | TOOM3_MUL_DIGITS 150 |
#define | DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG) |
Variables | |
VALUE | rb_cBignum |
static VALUE | big_three = Qnil |
const char | ruby_digitmap [] = "0123456789abcdefghijklmnopqrstuvwxyz" |
static VALUE | big2str_power_cache [35][MAX_BIG2STR_TABLE_ENTRIES] |
#define BDIGITS | ( | x | ) | (RBIGNUM_DIGITS(x)) |
Definition at line 35 of file bignum.c.
Referenced by big2dbl(), big2str_orig(), big2ulong(), big_fdiv(), big_lshift(), big_real_len(), big_rshift(), big_sparse_p(), big_split(), bigadd(), bigadd_int(), bigand_int(), bigdivrem(), bigfixize(), bigmul1_balance(), bigmul1_karatsuba(), bigmul1_normal(), bigmul1_single(), bigmul1_toom3(), bigor_int(), bigsqr_fast(), bigsub(), bigsub_int(), bigtrunc(), bigxor_int(), bigzero_p(), dbl2big(), get2comp(), rb_big_and(), rb_big_aref(), rb_big_clone(), rb_big_cmp(), rb_big_eq(), rb_big_eql(), rb_big_even_p(), rb_big_hash(), rb_big_neg(), rb_big_odd_p(), rb_big_or(), rb_big_pack(), rb_big_unpack(), rb_big_xor(), rb_cstr_to_inum(), rb_quad_pack(), rb_quad_unpack(), and rb_uint2big().
#define BIGDN | ( | x | ) | RSHIFT((x),BITSPERDIG) |
Definition at line 44 of file bignum.c.
Referenced by big_lshift(), bigadd_core(), bigadd_int(), bigand_int(), bigdivrem(), bigdivrem1(), bigmul1_normal(), bigmul1_single(), bigor_int(), bigsqr_fast(), bigsub_core(), bigsub_int(), bigxor_int(), get2comp(), rb_big_aref(), rb_big_unpack(), rb_cstr_to_inum(), and rb_uint2big().
Definition at line 45 of file bignum.c.
Referenced by big_lshift(), big_rshift(), bigadd_core(), bigadd_int(), bigand_int(), bigdivrem(), bigdivrem1(), bigmul1_normal(), bigmul1_single(), bigor_int(), bigsqr_fast(), bigsub_core(), bigsub_int(), bigxor_int(), get2comp(), rb_big_unpack(), rb_cstr_to_inum(), and rb_uint2big().
#define bignew | ( | len, | |
sign | |||
) | bignew_1(rb_cBignum,(len),(sign)) |
Definition at line 183 of file bignum.c.
Referenced by big_lshift(), big_rshift(), big_split(), bigadd(), bigadd_int(), bigand_int(), bigdivrem(), bigmul1_balance(), bigmul1_karatsuba(), bigmul1_normal(), bigmul1_single(), bigmul1_toom3(), bigor_int(), bigsqr_fast(), bigsub(), bigsub_int(), bigxor_int(), dbl2big(), rb_big_and(), rb_big_new(), rb_big_or(), rb_big_unpack(), rb_big_xor(), rb_cstr_to_inum(), rb_quad_unpack(), and rb_uint2big().
#define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG) |
Definition at line 37 of file bignum.c.
Referenced by big2dbl(), bigdivrem1(), bigor_int(), dbl2big(), and rb_big_or().
Definition at line 38 of file bignum.c.
Referenced by bigmul1_toom3().
#define BIGUP | ( | x | ) | ((BDIGIT_DBL)(x) << BITSPERDIG) |
Definition at line 43 of file bignum.c.
Referenced by big2str_orig(), big2ulong(), big_rshift(), bigdivrem(), bigdivrem1(), and bigfixize().
#define BIGZEROP | ( | x | ) |
Definition at line 48 of file bignum.c.
Referenced by big2str_find_n1(), big2str_karatsuba(), bigdivmod(), bigdivrem(), bigmul1_karatsuba(), rb_big2str0(), rb_big_pow(), rb_bigzero_p(), and rb_cmpint().
#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT) |
Definition at line 36 of file bignum.c.
Referenced by bdigbitsize(), big2dbl(), big2str_find_n1(), big_fdiv(), big_lshift(), big_rshift(), bigdivrem(), biglsh_bang(), bigrsh_bang(), nlz(), rb_big_aref(), rb_big_pack(), rb_big_pow(), and rb_cstr_to_inum().
#define BNEG | ( | b | ) | (RSHIFT(((BDIGIT*)(b))[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0) |
Definition at line 546 of file bignum.c.
Referenced by rb_quad_unpack().
#define conv_digit | ( | c | ) |
Referenced by rb_cstr_to_inum().
#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG) |
Referenced by big_fdiv().
#define DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS) |
Definition at line 39 of file bignum.c.
Referenced by big2ulong(), rb_big_aref(), rb_big_pack(), rb_big_unpack(), rb_num_to_uint(), and rb_uint2big().
#define ISDIGIT | ( | c | ) | ('0' <= (c) && (c) <= '9') |
#define KARATSUBA_DIGITS (1L<<LOG2_KARATSUBA_DIGITS) |
Definition at line 931 of file bignum.c.
Referenced by big2str_karatsuba(), power_cache_get_power(), power_cache_get_power0(), and rb_big2str0().
#define LOG2_KARATSUBA_DIGITS 7 |
Definition at line 930 of file bignum.c.
Referenced by power_cache_get_power().
#define MASK_0f 0x0f0f0f0fUL |
Referenced by ones().
#define MASK_33 0x33333333UL |
Referenced by ones().
#define MASK_55 0x55555555UL |
Referenced by ones().
#define MAX_BIG2STR_TABLE_ENTRIES 64 |
Definition at line 932 of file bignum.c.
Referenced by power_cache_get_power(), and power_cache_init().
#define POW2_P | ( | x | ) | (((x)&((x)-1))==0) |
Definition at line 868 of file bignum.c.
Referenced by ceil_log2().
#define QUAD_SIZE 8 |
Definition at line 440 of file bignum.c.
Referenced by rb_quad_pack(), and rb_quad_unpack().
#define RBIGNUM_SET_LEN | ( | b, | |
l | |||
) |
Definition at line 117 of file bignum.c.
Referenced by bigdivrem(), bigmul1_balance(), bignew_1(), rb_big_realloc(), rb_big_resize(), and rb_uint2big().
|
static |
Definition at line 2914 of file bignum.c.
References BDIGIT, BITSPERDIG, and size.
Referenced by big_fdiv().
|
static |
Definition at line 1342 of file bignum.c.
References BDIGIT, BDIGITS, BIGRAD, bigtrunc(), BITSPERDIG, DBL_MANT_DIG, DBL_MAX_EXP, i, lo, nlz(), RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by big_fdiv(), rb_big2dbl(), and rb_big_fdiv().
Definition at line 998 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 |
Definition at line 1068 of file bignum.c.
References big2str_orig(), bigdivmod(), BIGZEROP, KARATSUBA_DIGITS, len, power_cache_get_power(), and rb_big_resize().
Referenced by rb_big2str0().
Definition at line 1036 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGUP, i, len, MEMMOVE, RBIGNUM_LEN, and SIZEOF_BDIGITS.
Referenced by big2str_karatsuba(), and rb_big2str0().
Definition at line 1180 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGUP, DIGSPERLONG, len, rb_eRangeError, rb_raise(), and RBIGNUM_LEN.
Referenced by rb_big2long(), rb_big2ulong(), rb_big2ulong_pack(), rb_big_aref(), rb_big_lshift(), and rb_big_rshift().
Definition at line 2948 of file bignum.c.
References bdigbitsize(), BDIGITS, big2dbl(), big_shift(), bigdivrem(), bigtrunc(), BITSPERDIG, dbl2big(), DBL2NUM, DBL_BIGDIG, DBL_MANT_DIG, FIX2LONG, i, INFINITY, rb_bug(), rb_int2big(), RBIGNUM_LEN, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by rb_big_fdiv().
Definition at line 3458 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, BITSPERDIG, i, len, RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by big_shift(), bigmul1_toom3(), rb_big_lshift(), and rb_big_rshift().
Definition at line 1477 of file bignum.c.
References FIX2INT, INT2FIX, isinf(), NIL_P, Qfalse, Qtrue, Qundef, rb_big2dbl(), rb_big_cmp(), rb_dbl_cmp(), rb_intern, rb_num_coerce_relop(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Definition at line 1993 of file bignum.c.
References BDIGIT, BDIGITS, and RBIGNUM_LEN.
Referenced by bigmul1_balance(), bigmul1_karatsuba(), and bigmul1_toom3().
Definition at line 3524 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGLO, bignew, BIGUP, BITSPERDIG, get2comp(), i, INT2FIX, rb_big_clone(), RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by big_shift(), rb_big_lshift(), and rb_big_rshift().
Definition at line 2938 of file bignum.c.
References big_lshift(), and big_rshift().
Referenced by big_fdiv().
Definition at line 2495 of file bignum.c.
References BDIGITS, Qfalse, Qtrue, rb_genrand_ulong_limited(), and RBIGNUM_LEN.
Referenced by bigmul0().
Definition at line 2091 of file bignum.c.
References BDIGIT, BDIGITS, bignew, MEMCPY, rb_uint2big(), and RBIGNUM_LEN.
Referenced by big_split3(), and bigmul1_karatsuba().
|
static |
Definition at line 2270 of file bignum.c.
References big_split(), and bigtrunc().
Referenced by bigmul1_toom3().
Definition at line 1892 of file bignum.c.
References BDIGITS, bigadd_core(), bignew, bigsub(), len, RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by bigdivmod(), bigmul1_toom3(), rb_big_minus(), and rb_big_plus().
|
static |
Definition at line 1858 of file bignum.c.
References assert, BDIGIT, BDIGIT_DBL, BIGDN, BIGLO, and i.
Referenced by bigadd(), bigmul1_balance(), bigmul1_karatsuba(), and bigmul1_toom3().
Definition at line 1805 of file bignum.c.
References assert, BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), i, RB_GC_GUARD, RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by rb_big_minus(), and rb_big_plus().
Definition at line 3124 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), get2comp(), i, INT2FIX, LONG2NUM, RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by rb_big_and().
Definition at line 2750 of file bignum.c.
References bigadd(), bigdivrem(), BIGZEROP, mod, rb_int2big(), and RBIGNUM_SIGN.
Referenced by big2str_karatsuba(), rb_big_divide(), rb_big_divmod(), and rb_big_modulo().
Definition at line 2634 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, bigdivrem1(), BIGDN, BIGLO, bignew, BIGUP, BIGZEROP, BITSPERDIG, i, big_div_struct::nx, big_div_struct::ny, Qfalse, Qnil, rb_big_clone(), rb_big_stop(), RB_GC_GUARD, rb_int2big(), rb_num_zerodiv(), rb_thread_blocking_region(), rb_uint2big(), RBIGNUM_LEN, RBIGNUM_SET_LEN, RBIGNUM_SET_SIGN, RBIGNUM_SIGN, big_div_struct::stop, big_div_struct::yds, and big_div_struct::zds.
Referenced by big_fdiv(), bigdivmod(), bigmul1_toom3(), and rb_big_remainder().
|
static |
Definition at line 2582 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGIT_DBL_SIGNED, BIGDN, BIGLO, BIGRAD, BIGUP, i, big_div_struct::nx, big_div_struct::ny, Qnil, big_div_struct::stop, big_div_struct::yds, and big_div_struct::zds.
Referenced by bigdivrem().
Definition at line 245 of file bignum.c.
References BDIGIT, BDIGITS, BIGUP, INT2FIX, len, long, LONG2FIX, NEGFIXABLE, POSFIXABLE, RBIGNUM_LEN, RBIGNUM_SIGN, and SIZEOF_BDIGITS.
Referenced by bignorm().
Definition at line 2218 of file bignum.c.
References BDIGIT, BITSPERDIG, i, and MEMZERO.
Referenced by bigmul1_toom3().
Definition at line 2507 of file bignum.c.
References assert, big_sparse_p(), bigmul1_balance(), bigmul1_karatsuba(), bigmul1_normal(), bigmul1_single(), bigmul1_toom3(), bigsqr_fast(), KARATSUBA_MUL_DIGITS, RBIGNUM_LEN, and TOOM3_MUL_DIGITS.
Referenced by bigmul1_balance(), bigmul1_karatsuba(), bigmul1_toom3(), bigsqr(), rb_big_mul(), and rb_big_pow().
Definition at line 2054 of file bignum.c.
References assert, BDIGIT, BDIGITS, big_real_len(), bigadd_core(), bigmul0(), bignew, i, MEMCPY, RBIGNUM_LEN, RBIGNUM_SET_LEN, and RBIGNUM_SIGN.
Referenced by bigmul0().
Definition at line 2123 of file bignum.c.
References BDIGIT, BDIGITS, big_real_len(), big_split(), bigadd_core(), bigmul0(), bignew, bigsub_core(), BIGZEROP, i, MEMCPY, Qundef, RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by bigmul0().
Definition at line 2020 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, i, rb_thread_check_ints(), RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by bigmul0().
Definition at line 2002 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, and RBIGNUM_SIGN.
Referenced by bigmul0().
Definition at line 2287 of file bignum.c.
References assert, BDIGIT, BDIGITS, big_lshift(), big_real_len(), big_split3(), big_three, bigadd(), bigadd_core(), bigdivrem(), biglsh_bang(), bigmul0(), bignew, bignorm(), BIGRAD_HALF, bigrsh_bang(), bigsub(), bigtrunc(), MEMCPY, MEMZERO, NULL, Qnil, rb_big_resize(), RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by bigmul0().
Definition at line 166 of file bignum.c.
References ALLOC_N, BDIGIT, len, NEWOBJ, OBJSETUP, RBASIC, RBIGNUM, RBIGNUM_EMBED_FLAG, RBIGNUM_EMBED_LEN_MAX, RBIGNUM_SET_LEN, RBIGNUM_SET_SIGN, and T_BIGNUM.
Referenced by rb_big_clone().
Definition at line 273 of file bignum.c.
References bigfixize(), bigtrunc(), FIXNUM_P, T_BIGNUM, and TYPE.
Referenced by bigadd_int(), bigand_int(), bigmul1_toom3(), bigor_int(), bigsub_int(), bigxor_int(), rb_big_and(), rb_big_divide(), rb_big_divmod(), 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_unpack(), rb_big_xor(), rb_cstr_to_inum(), rb_dbl2big(), and rb_quad_unpack().
Definition at line 3223 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), BIGRAD, get2comp(), i, RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by rb_big_or().
Definition at line 2244 of file bignum.c.
References BDIGIT, BITSPERDIG, i, and MEMZERO.
Referenced by bigmul1_toom3().
Definition at line 3040 of file bignum.c.
References bigmul0(), and bigtrunc().
Referenced by power_cache_get_power(), power_cache_get_power0(), and rb_big_pow().
Definition at line 1717 of file bignum.c.
References BDIGIT, BDIGITS, bignew, bigsub_core(), and RBIGNUM_LEN.
Referenced by bigadd(), bigmul1_toom3(), and bigsub_int().
|
static |
Definition at line 1691 of file bignum.c.
References assert, BDIGIT_DBL_SIGNED, BIGDN, BIGLO, and i.
Referenced by bigmul1_karatsuba(), and bigsub().
Definition at line 1753 of file bignum.c.
References BDIGIT, BDIGIT_DBL_SIGNED, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), bigsub(), i, RB_GC_GUARD, rb_int2big(), RBIGNUM_LEN, RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.
Referenced by rb_big_minus(), and rb_big_plus().
Definition at line 231 of file bignum.c.
References BDIGIT, BDIGITS, len, rb_big_resize(), and RBIGNUM_LEN.
Referenced by big2dbl(), big_fdiv(), big_split3(), bigmul1_toom3(), bignorm(), bigsqr(), rb_big_aref(), and rb_big_pow().
Definition at line 3315 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), get2comp(), i, RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by rb_big_xor().
|
static |
Definition at line 3112 of file bignum.c.
References FIXNUM_P, rb_eTypeError, rb_raise(), rb_to_int(), T_BIGNUM, T_FLOAT, and TYPE.
Referenced by rb_big_and(), rb_big_or(), and rb_big_xor().
|
inlinestatic |
Definition at line 925 of file bignum.c.
References floor_log2(), and POW2_P.
Referenced by power_cache_get_power().
Definition at line 3410 of file bignum.c.
References INT2FIX, Qnil, RBIGNUM_LEN, RBIGNUM_SIGN, and SIZEOF_BDIGITS.
Referenced by rb_big_lshift(), and rb_big_rshift().
|
static |
Definition at line 1283 of file bignum.c.
References BDIGIT, BDIGITS, bignew, BIGRAD, i, isinf(), isnan, POSFIXABLE, rb_eFloatDomainError, and rb_raise().
Referenced by big_fdiv(), and rb_dbl2big().
|
inlinestatic |
|
static |
Definition at line 203 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, i, rb_big_resize(), and RBIGNUM_LEN.
Referenced by big_rshift(), bigand_int(), bigor_int(), bigxor_int(), rb_big_2comp(), rb_big_and(), rb_big_neg(), rb_big_or(), rb_big_unpack(), and rb_big_xor().
void Init_Bignum | ( | void | ) |
Definition at line 3752 of file bignum.c.
References big_ge(), big_gt(), big_le(), big_lt(), big_three, power_cache_init(), rb_big_abs(), rb_big_and(), rb_big_aref(), 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_class(), rb_define_method(), rb_gc_register_mark_object(), and rb_uint2big().
|
static |
Definition at line 1321 of file bignum.c.
References BDIGIT, and BITSPERDIG.
Referenced by big2dbl().
|
inlinestatic |
Definition at line 960 of file bignum.c.
References bigsqr(), ceil_log2(), i, KARATSUBA_DIGITS, LOG2_KARATSUBA_DIGITS, MAX_BIG2STR_TABLE_ENTRIES, power_cache_get_power0(), and rb_bug().
Referenced by big2str_karatsuba().
|
inlinestatic |
Definition at line 948 of file bignum.c.
References bigsqr(), i, INT2FIX, KARATSUBA_DIGITS, NIL_P, rb_big_pow(), rb_gc_register_mark_object(), and rb_int2big().
Referenced by power_cache_get_power().
|
static |
Definition at line 937 of file bignum.c.
References i, MAX_BIG2STR_TABLE_ENTRIES, and Qnil.
Referenced by Init_Bignum().
|
static |
Definition at line 513 of file bignum.c.
Referenced by rb_quad_pack(), and rb_quad_unpack().
double rb_big2dbl | ( | VALUE | x | ) |
Definition at line 1391 of file bignum.c.
References big2dbl(), isinf(), and rb_warning().
Referenced by big_op(), flo_cmp(), flo_div(), flo_divmod(), flo_eq(), flo_ge(), flo_gt(), flo_le(), flo_lt(), flo_minus(), flo_mod(), flo_mul(), flo_plus(), flo_pow(), int_pair_to_real_inclusive(), ole_val2ptr_variant(), ole_val2variant(), rb_big_cmp(), rb_big_divide(), rb_big_eq(), 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 1225 of file bignum.c.
References big2ulong(), LONG_MIN, rb_eRangeError, rb_raise(), RBIGNUM_SIGN, SIGNED_VALUE, and TRUE.
Referenced by rb_num2long().
Definition at line 1145 of file bignum.c.
References rb_big2str0().
Referenced by GetVpValueWithPrec(), rb_big_to_s(), and rb_str_format().
Definition at line 1099 of file bignum.c.
References big2str_find_n1(), big2str_karatsuba(), big2str_orig(), BIGZEROP, FIXNUM_P, KARATSUBA_DIGITS, len, rb_big_clone(), rb_big_resize(), rb_eArgError, rb_fix2str(), rb_raise(), rb_str_resize(), rb_usascii_str_new(), rb_usascii_str_new2(), RBIGNUM_SET_SIGN, RBIGNUM_SIGN, and RSTRING_PTR.
Referenced by rb_big2str(), and rb_str_format().
Definition at line 1211 of file bignum.c.
References big2ulong(), rb_eRangeError, rb_raise(), RBIGNUM_SIGN, SIGNED_VALUE, and TRUE.
Referenced by rb_gzfile_set_mtime(), rb_num2ulong(), and rb_num_to_uint().
Definition at line 1201 of file bignum.c.
References big2ulong(), FALSE, RBIGNUM_SIGN, and SIGNED_VALUE.
Referenced by rb_dlcfunc_call().
void rb_big_2comp | ( | VALUE | x | ) |
Definition at line 3674 of file bignum.c.
References rb_big_clone(), RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.
Referenced by Init_Bignum().
Definition at line 3175 of file bignum.c.
References BDIGIT, BDIGITS, bigand_int(), bignew, bignorm(), bit_coerce(), FIX2LONG, FIXNUM_P, get2comp(), i, rb_big_clone(), RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by fix_and(), and Init_Bignum().
Definition at line 3586 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, big2ulong(), BIGDN, bigtrunc(), BITSPERDIG, DIGSPERLONG, FALSE, i, INT2FIX, NUM2LONG(), RBIGNUM_LEN, RBIGNUM_SIGN, shift(), T_BIGNUM, and TYPE.
Referenced by Init_Bignum().
Definition at line 192 of file bignum.c.
References BDIGIT, BDIGITS, bignew_1(), CLASS_OF, len, MEMCPY, RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by big_rshift(), bigdivrem(), limited_big_rand(), rand_int(), rb_big2str0(), rb_big_abs(), rb_big_and(), rb_big_neg(), rb_big_or(), rb_big_uminus(), rb_big_xor(), and rb_str_format().
Definition at line 1431 of file bignum.c.
References BDIGIT, BDIGITS, FIX2LONG, INT2FIX, isinf(), rb_big2dbl(), rb_dbl_cmp(), rb_int2big(), rb_intern, rb_num_coerce_cmp(), RBIGNUM_LEN, RBIGNUM_SIGN, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by big_op(), fix_cmp(), fix_ge(), fix_gt(), fix_le(), fix_lt(), and Init_Bignum().
Definition at line 3648 of file bignum.c.
References FIX2LONG, FIXNUM_P, Qnil, rb_assoc_new(), rb_eTypeError, rb_int2big(), rb_obj_classname(), rb_raise(), T_BIGNUM, and TYPE.
Referenced by Init_Bignum().
Definition at line 2807 of file bignum.c.
References rb_big_divide().
Referenced by fix_divide(), and Init_Bignum().
Definition at line 2766 of file bignum.c.
References bigdivmod(), bignorm(), DBL2NUM, div, FIX2LONG, rb_big2dbl(), rb_dbl2big(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by rb_big_div(), and rb_big_idiv().
Definition at line 2893 of file bignum.c.
References bigdivmod(), bignorm(), div, FIX2LONG, mod, rb_assoc_new(), rb_int2big(), rb_intern, rb_num_coerce_bin(), T_BIGNUM, T_FIXNUM, and TYPE.
Referenced by fix_divmod(), Init_Bignum(), and pack_pack().
Definition at line 1594 of file bignum.c.
References BDIGIT, BDIGITS, FIX2LONG, isinf(), isnan, MEMCMP, Qfalse, Qtrue, rb_big2dbl(), rb_equal(), rb_int2big(), RBIGNUM_LEN, RBIGNUM_SIGN, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by fix_equal(), and Init_Bignum().
Definition at line 1632 of file bignum.c.
References BDIGIT, BDIGITS, MEMCMP, Qfalse, Qtrue, RBIGNUM_LEN, RBIGNUM_SIGN, T_BIGNUM, and TYPE.
Referenced by Init_Bignum().
Definition at line 3007 of file bignum.c.
References big2dbl(), big_fdiv(), DBL2NUM, FIX2LONG, isinf(), isnan, rb_big2dbl(), rb_intern, rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by fix_fdiv(), and Init_Bignum().
Definition at line 3635 of file bignum.c.
References BDIGIT, BDIGITS, hash(), INT2FIX, rb_memhash(), RBIGNUM_LEN, and RBIGNUM_SIGN.
Referenced by Init_Bignum().
Definition at line 2820 of file bignum.c.
References rb_big_divide(), and rb_intern.
Referenced by Init_Bignum().
Definition at line 3427 of file bignum.c.
References big2ulong(), big_lshift(), big_rshift(), bignorm(), check_shiftdown(), FIX2LONG, FIXNUM_P, NIL_P, rb_to_int(), RBIGNUM_SIGN, shift(), T_BIGNUM, TRUE, and TYPE.
Referenced by fix_lshift(), Init_Bignum(), and rb_fix_lshift().
Definition at line 1963 of file bignum.c.
References bigadd(), bigadd_int(), bignorm(), bigsub_int(), DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RBIGNUM_SIGN, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by fix_minus(), Init_Bignum(), rand_int(), rand_range(), sub(), and wsub().
Definition at line 2835 of file bignum.c.
References bigdivmod(), bignorm(), FIX2LONG, rb_int2big(), rb_num_coerce_bin(), T_BIGNUM, T_FIXNUM, and TYPE.
Referenced by fix_mod(), Init_Bignum(), and mod().
Definition at line 2555 of file bignum.c.
References bigmul0(), bignorm(), DBL2NUM, FIX2LONG, rb_big2dbl(), rb_int2big(), rb_num_coerce_bin(), RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by f_imul(), fix_mul(), Init_Bignum(), int_pair_to_real_inclusive(), int_pow(), mul(), pack_unpack(), and wmul().
Definition at line 1671 of file bignum.c.
References BDIGIT, BDIGITS, bignorm(), get2comp(), i, INT2FIX, rb_big_clone(), RBIGNUM_LEN, RBIGNUM_SET_SIGN, RBIGNUM_SIGN, and SIGNED_VALUE.
Referenced by Init_Bignum().
Definition at line 186 of file bignum.c.
References bignew.
Referenced by int_pair_to_real_inclusive(), and mt_state().
Definition at line 282 of file bignum.c.
References bignorm().
Referenced by fix_aref(), limited_big_rand(), make_seed_value(), mt_state(), r_object0(), and rand_range().
Definition at line 3266 of file bignum.c.
References BDIGIT, BDIGITS, bignew, bignorm(), bigor_int(), BIGRAD, bit_coerce(), FIX2LONG, FIXNUM_P, get2comp(), i, rb_big_clone(), RBIGNUM_LEN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by fix_or(), and Init_Bignum().
Definition at line 357 of file bignum.c.
References BDIGIT, BDIGITS, BITSPERDIG, DIGSPERLONG, FIX2LONG, FIXNUM_P, i, len, long, rb_to_int(), RBIGNUM_LEN, and RBIGNUM_NEGATIVE_P.
Referenced by pack_pack().
Definition at line 1926 of file bignum.c.
References bigadd(), bigadd_int(), bignorm(), bigsub_int(), DBL2NUM, FIX2LONG, rb_big2dbl(), rb_num_coerce_bin(), RBIGNUM_SIGN, RFLOAT_VALUE, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by add(), fix_plus(), Init_Bignum(), pack_unpack(), rand_range(), rb_random_int32(), and wadd().
Definition at line 3059 of file bignum.c.
References bigmul0(), bignorm(), bigsqr(), bigtrunc(), BIGZEROP, BITSPERDIG, DBL2NUM, ffs(), FIX2LONG, FIXNUM_MAX, INT2FIX, rb_big2dbl(), rb_complex_raw1, rb_funcall(), rb_intern, rb_num_coerce_bin(), rb_rational_raw1, rb_warn(), RBIGNUM_DIGITS, RBIGNUM_LEN, RBIGNUM_SIGN, RFLOAT_VALUE, round(), SIGNED_VALUE, SIZEOF_BDIGITS, T_BIGNUM, T_FIXNUM, T_FLOAT, and TYPE.
Referenced by fix_pow(), Init_Bignum(), int_pow(), and power_cache_get_power0().
Definition at line 125 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, and xfree().
Referenced by rb_big_resize().
Definition at line 2865 of file bignum.c.
References bigdivrem(), bignorm(), FIX2LONG, rb_int2big(), rb_intern, rb_num_coerce_bin(), T_BIGNUM, T_FIXNUM, and TYPE.
Referenced by Init_Bignum().
Definition at line 159 of file bignum.c.
References rb_big_realloc(), and RBIGNUM_SET_LEN.
Referenced by big2str_karatsuba(), bigmul1_toom3(), bigtrunc(), get2comp(), make_seed_value(), r_object0(), and rb_big2str0().
Definition at line 3491 of file bignum.c.
References big2ulong(), big_lshift(), big_rshift(), bignorm(), check_shiftdown(), FIX2LONG, FIXNUM_P, NIL_P, rb_to_int(), RBIGNUM_SIGN, shift(), T_BIGNUM, TRUE, and TYPE.
Referenced by Init_Bignum(), int_pair_to_real_inclusive(), and rb_fix_rshift().
Definition at line 3696 of file bignum.c.
References LONG2FIX, RBIGNUM_LEN, and SIZEOF_BDIGITS.
Referenced by Init_Bignum().
|
static |
Definition at line 2627 of file bignum.c.
References Qtrue, and big_div_struct::stop.
Referenced by bigdivrem().
Definition at line 1415 of file bignum.c.
References DBL2NUM, and rb_big2dbl().
Referenced by Init_Bignum().
Definition at line 1165 of file bignum.c.
References NUM2INT, rb_big2str(), and rb_scan_args().
Referenced by Init_Bignum().
Definition at line 1649 of file bignum.c.
References bignorm(), rb_big_clone(), RBIGNUM_SET_SIGN, and RBIGNUM_SIGN.
Referenced by Init_Bignum().
Definition at line 399 of file bignum.c.
References BDIGIT, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), DIGSPERLONG, get2comp(), i, INT2FIX, len, LONG2NUM, and RBIGNUM_SET_SIGN.
Referenced by pack_unpack().
Definition at line 3357 of file bignum.c.
References BDIGIT, BDIGITS, bignew, bignorm(), bigxor_int(), bit_coerce(), FIX2LONG, FIXNUM_P, get2comp(), i, rb_big_clone(), RBIGNUM_LEN, RBIGNUM_SET_SIGN, RBIGNUM_SIGN, and big_div_struct::zds.
Referenced by fix_xor(), and Init_Bignum().
int rb_bigzero_p | ( | VALUE | x | ) |
Definition at line 90 of file bignum.c.
References BIGZEROP.
Referenced by rand_int(), and rand_range().
Definition at line 96 of file bignum.c.
References BIGZEROP, FIX2LONG, FIXNUM_P, INT2FIX, NIL_P, rb_cmperr(), rb_funcall(), RBIGNUM_SIGN, RTEST, T_BIGNUM, and TYPE.
Referenced by cmp(), cmp_eq(), cmp_ge(), cmp_gt(), cmp_le(), cmp_lt(), 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_max(), range_min(), sort_1(), sort_2(), sort_by_cmp(), time_cmp(), and wcmp().
Definition at line 852 of file bignum.c.
References rb_cstr_to_inum().
Referenced by yaml_org_handler().
Definition at line 567 of file bignum.c.
References bad, BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, bignorm(), BITSPERDIG, CHAR_BIT, conv_digit, i, INT2FIX, ISSPACE, len, long, LONG2FIX, POSFIXABLE, rb_eArgError, rb_invalid_str(), rb_raise(), rb_uint2big(), RBIGNUM_SET_SIGN, result, strlen(), and STRTOUL.
Referenced by asn1integer_to_num(), ossl_bn_to_i(), parser_yylex(), rb_cstr2inum(), rb_str_to_inum(), read_digits(), and tkstr_to_int().
VALUE rb_dbl2big | ( | double | d | ) |
Definition at line 1315 of file bignum.c.
References bignorm(), and dbl2big().
Referenced by case_when_optimizable_literal(), dbl2ival(), fix_divide(), flo_ceil(), flo_floor(), flo_truncate(), float_decode_internal(), nurat_div(), rb_big_divide(), rb_convert_to_integer(), and rb_str_format().
VALUE rb_int2big | ( | SIGNED_VALUE | n | ) |
Definition at line 309 of file bignum.c.
References neg, rb_uint2big(), and RBIGNUM_SET_SIGN.
Referenced by big_fdiv(), bigdivmod(), bigdivrem(), bigsub_int(), 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(), power_cache_get_power0(), rb_big_cmp(), rb_big_coerce(), rb_big_divide(), rb_big_divmod(), rb_big_eq(), rb_big_modulo(), rb_big_mul(), rb_big_remainder(), rb_fix_lshift(), rb_fix_rshift(), rb_int2inum(), rb_quad_pack(), rb_str_format(), and w_object().
VALUE rb_int2inum | ( | SIGNED_VALUE | n | ) |
Definition at line 333 of file bignum.c.
References FIXABLE, LONG2FIX, and rb_int2big().
Referenced by gzfile_reader_rewind().
void rb_quad_pack | ( | char * | buf, |
VALUE | val | ||
) |
Definition at line 527 of file bignum.c.
References BDIGITS, FIX2LONG, FIXNUM_P, len, quad_buf_complement(), QUAD_SIZE, rb_int2big(), rb_to_int(), RBIGNUM_LEN, RBIGNUM_NEGATIVE_P, and SIZEOF_BDIGITS.
Definition at line 549 of file bignum.c.
References BDIGITS, bignew, bignorm(), BNEG, quad_buf_complement(), QUAD_SIZE, RBIGNUM_SET_SIGN, and SIZEOF_BDIGITS.
Definition at line 858 of file bignum.c.
References rb_str_to_inum().
Referenced by syck_resolver_transfer().
Definition at line 765 of file bignum.c.
References ALLOCV, ALLOCV_END, len, MEMCPY, p, rb_cstr_to_inum(), RSTRING_LEN, RSTRING_PTR, StringValue, StringValueCStr, and v.
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().
Definition at line 288 of file bignum.c.
References BDIGIT, BDIGIT_DBL, BDIGITS, BIGDN, BIGLO, bignew, DIGSPERLONG, i, and RBIGNUM_SET_LEN.
Referenced by big_split(), bigdivrem(), Init_Bignum(), pack_pack(), pack_unpack(), rb_cstr_to_inum(), rb_int2big(), and rb_uint2inum().
Definition at line 326 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(), and rb_zstream_total_out().
|
static |
Definition at line 29 of file bignum.c.
Referenced by bigmul1_toom3(), and Init_Bignum().
VALUE rb_cBignum |
Definition at line 27 of file bignum.c.
Referenced by generate_json(), Init_Bignum(), Init_RandomSeed2(), k_bignum_p(), make_seed_value(), r_object0(), and syck_resolver_transfer().
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz" |
Definition at line 863 of file bignum.c.
Referenced by rb_fix2str().