aboutsummaryrefslogtreecommitdiffstats
path: root/bignum.c
Commit message (Collapse)AuthorAgeFilesLines
* internal.h: roomofnobu2015-06-211-1/+0
| | | | | | | * internal.h (roomof): extract from type_roomof, and move from bignum.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c: doc of rb_cstr_to_inumnobu2015-06-171-0/+16
| | | | | | * bignum.c (rb_cstr_to_inum): [DOC] add document of the function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * doc/contributors.rdoc: fix a typo. Patch by @davydovantonhsbt2015-04-151-1/+1
| | | | | | | | | | [fix GH-872][ci skip] * doc/syntax/methods.rdoc: ditto. * ext/digest/sha2/sha2.c: ditto. * ext/socket/ipsocket.c: ditto. * ext/tk/*: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-2/+1
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bary_mul_balance_with_mulfunc): Fix free work areaakr2014-11-011-1/+1
| | | | | | | | | | | location. [ruby-dev:48723] [Bug #10464] [ruby-core:66044] [Bug #10465] Reported by Kohji Nishihama. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (absint_numwords_generic): set an array element afterngoto2014-10-091-1/+3
| | | | | | | | | definition of a variable to fix compile error with older version of fcc (Fujitsu C Compiler) 5.6 on Solaris 10 on Sparc. [Bug #10350] [ruby-dev:48608] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add some documents [ci skip]nobu2014-07-281-0/+1
| | | | | | | | | | | | | | | * bignum.c (Init_Bignum): [DOC] Bignum::GMP_VERSION. * complex.c (Init_Complex): [DOC] ignore an internal class. * dir.c (Init_Dir): [DOC] File::FNM_SYSCASE. * file.c (rb_file_exists_p): [DOC] File.exists? is deprecated. * object.c (rb_mod_initialize_clone): [DOC] ignore implementation detail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (struct RBignum): Use size_t for len.akr2014-04-191-17/+22
| | | | | | | | | | | | | | | | * include/ruby/intern.h (rb_big_new): Use size_t instead of long to specify the size of bignum. (rb_big_resize): Ditto. * bignum.c: Follow above changes. * rational.c: Follow above changes. * marshal.c: Follow above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (rb_num2long): Returns a long.akr2014-04-181-2/+2
| | | | | | | | | | | | | | | | | (rb_num2ulong): Returns a unsigned long. * bignum.c (rb_big2long): Returns a long. (rb_big2ulong): Returns a unsigned long. * include/ruby/intern.h: Follow above changes. * include/ruby/ruby.h: Follow above changes. (rb_num2long_inline): No need to cast. (rb_num2ulong_inline): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.akr2014-04-131-77/+77
| | | | | | | | | | | | * internal.h: Ditto. * marshal.c: Ditto. * rational.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c: adjust condtionsnobu2014-03-141-7/+4
| | | | | | | * bignum.c (maxpow{16,32,64,128}_{exp,num}): adjust preprocessor condtions to maxpow_in_bdigit_dbl(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] add links to `Object#hash`nobu2014-03-141-0/+2
| | | | | | | add links to `Object#hash` to each #`hash` methods rdocs. [Fixes GH-567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* adjust indent and stylenobu2014-02-271-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bary_mul_precheck): fix a copy-paste error.mame2014-02-211-1/+1
| | | | | | Coverity Scan found this bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.akr2014-02-151-164/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS. (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX. (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT. (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN. (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN. (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P. (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P. (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG. (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK. (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT. (BIGNUM_LEN): Renamed from RBIGNUM_LEN. (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS. (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT. * bignum.c: Follow the above change. * gc.c: Ditto. * marshal.c: Ditto. * math.c: Ditto. * numeric.c: Ditto. * random.c: Ditto. * rational.c: Ditto. * sprintf.c: Ditto. * ext/-test-/bignum/bigzero.c: Ditto. * ext/-test-/bignum/intpack.c: Ditto. * ext/bigdecimal/bigdecimal.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_cmp): Avoid bignum allocation for comparisonakr2014-02-151-7/+11
| | | | | | | | between bignum and fixnum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h,akr2014-02-141-118/+0
| | | | | | | | | | | | | | | | | | | | | include/ruby/io.h, include/ruby/ruby.h, include/ruby/win32.h, include/ruby/backward/rubysig.h, bignum.c, gc.c, io.c, process.c, safe.c, struct.c, thread.c, ext/socket/rubysocket.h, ext/-test-/old_thread_select: Remove deprecated definitions [ruby-core:60581] [Feature #9502] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC]akr2014-02-111-0/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_cmp): Specialize a comparison to zero.akr2014-02-111-1/+6
| | | | | | | | | * ext/bigdecimal/bigdecimal.c (is_negative): Use rb_big_cmp instead of RBIGNUM_NEGATIVE_P. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigxor_int): Apply BIGLO for long in a BDIGIT expression.akr2013-11-241-3/+3
| | | | | | | | | | (bigor_int): Ditto. (bigand_int): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/defines.h: Don't use int128_t for Bignum.akr2013-11-241-3/+1
| | | | | | | | | | It's not always faster. * bignum.c: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c: suppress warningnobu2013-11-191-1/+5
| | | | | | | * bignum.c (absint_numwords_generic): suppress false warning in rb_absint_numwords() by gcc 4.4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c, math.c: RB_BIGNUM_TYPE_Pnobu2013-09-071-22/+24
| | | | | | | * bignum.c, math.c (RB_BIGNUM_TYPE_P): predicate macro like RB_FLOAT_TYPE_P. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c, math.c: type predicatesnobu2013-09-071-133/+91
| | | | | | * bignum.c, math.c: use type predicate macros instead of TYPE(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bignum.c: split rb_big_fdiv and big_fdivnobu2013-09-071-23/+25
| | | | | | * bignum.c (rb_big_fdiv): split with big_fdiv by divider type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (GMP_DIV_DIGITS): New macro.akr2013-09-041-3/+98
| | | | | | | | | | | | | | (bary_divmod_gmp): New function. (rb_big_divrem_gmp): Ditto. (bary_divmod_branch): Ditto. (bary_divmod): Use bary_divmod_branch. (bigdivrem): Ditto. * internal.h (rb_big_divrem_gmp): Declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bary_divmod_normal): Reduce temporary array allocations.akr2013-09-041-15/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_divrem_normal): Add GC guards.akr2013-09-041-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_divrem_normal): New function.akr2013-09-041-0/+32
| | | | | | | | | | | | * internal.h (rb_big_divrem_normal): Declared. * ext/-test-/bignum/div.c: New file. * test/-ext-/bignum/test_div.rb: New file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigdivrem_normal): Removed.akr2013-09-041-76/+81
| | | | | | | | | | (bary_divmod_normal): New function. (bary_divmod): Use bary_divmod_normal. (bigdivrem): Use bary_divmod_normal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigdivrem): Useless declaration removed.akr2013-09-041-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bigdivrem_normal): Add assertions.akr2013-09-041-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (GMP_STR2BIG_DIGITS): New macro.akr2013-09-031-0/+92
| | | | | | | | | | | | (str2big_gmp): New function. (rb_cstr_to_inum): Use str2big_gmp for big bignums. (rb_str2big_gmp): New function. * internal.h (rb_str2big_gmp): Declared. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_str2big_poweroftwo): New function.akr2013-09-031-0/+111
| | | | | | | | | | | | | | | | | | | (rb_str2big_normal): Ditto. (rb_str2big_karatsuba): Ditto. * internal.h (rb_str2big_poweroftwo): Declared. (rb_str2big_normal): Ditto. (rb_str2big_karatsuba): Ditto. * ext/-test-/bignum/str2big.c: New file. * test/-ext-/bignum/test_str2big.rb: New file. * ext/-test-/bignum/depend: Add the dependency for str2big.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (str2big_scan_digits): Extracted from rb_cstr_to_inum.akr2013-09-031-32/+51
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bytes_2comp): Define it only for little endianakr2013-09-021-0/+2
| | | | | | | | environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (ISDIGIT): Unused macro removed.akr2013-09-021-3/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (str2big_poweroftwo): Extracted from rb_cstr_to_inum.akr2013-09-021-117/+178
| | | | | | | | | (str2big_normal): Ditto. (str2big_karatsuba): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (Init_Bignum): Define Bignum::GMP_VERSION when GMP is used.akr2013-09-011-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_generic): Reduce arguments.akr2013-09-011-30/+36
| | | | | | | | | (big2str_gmp): Ditto. (rb_big2str1): Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (GMP_BIG2STR_DIGITS): New constant.akr2013-09-011-0/+55
| | | | | | | | | | | | | (big2str_gmp): New function. (rb_big2str1): Use big2str_gmp for big bignums. * internal.h (rb_big2str_gmp): Declared. * ext/-test-/bignum/big2str.c (big2str_gmp): New method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bary_mul_gmp): Use mpz_init and mpz_clear instead ofakr2013-09-011-2/+6
| | | | | | | | | mpz_inits and mpz_clears. Older GMP don't have them. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_base_poweroftwo): Renamed fromakr2013-09-011-28/+54
| | | | | | | | | | | | | | | | | | big2str_base_powerof2. (rb_big2str_poweroftwo): New function for test. (big2str_generic): Extracted from rb_big2str1. (rb_big2str_generic): New function for test. * internal.h (rb_big2str_poweroftwo): Declared. (rb_big2str_generic): Ditto. * ext/-test-/bignum/big2str.c: New file. * test/-ext-/bignum/test_big2str.rb: New file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big2str_2bdigits): Renamed from big2str_orig.akr2013-09-011-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,akr2013-09-011-4/+1
| | | | | | | SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (maxpow_in_bdigit): Removed.akr2013-09-011-37/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (rb_fix_bit_length): Moved from bignum.c.akr2013-09-011-41/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC]akr2013-09-011-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (bit_length): Moved from bignum.c.akr2013-09-011-126/+0
| | | | | | | | | | | (nlz_int): Ditto. (nlz_long): Ditto. (nlz_long_long): Ditto. (nlz_int128): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (bit_length): Renamed from bitsize.akr2013-08-311-11/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e