Граф коммитов

674 Коммитов

Автор SHA1 Сообщение Дата
nobu bb4d72c51f make local symbols static
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 15:07:41 +00:00
nobu 4191a6b90d preserve encodings in error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28 02:40:46 +00:00
nobu bbe805f09e internal.h: roomof
* 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
2015-06-21 11:28:12 +00:00
nobu 61da10499f bignum.c: doc of rb_cstr_to_inum
* 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
2015-06-17 12:11:53 +00:00
hsbt d9a2b3480e * doc/contributors.rdoc: fix a typo. Patch by @davydovanton
[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
2015-04-15 01:37:47 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
akr 905b52217c * bignum.c (bary_mul_balance_with_mulfunc): Fix free work area
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
2014-11-01 08:13:30 +00:00
ngoto 9631e3e788 * bignum.c (absint_numwords_generic): set an array element after
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
2014-10-09 14:36:35 +00:00
nobu aa3b506270 add some documents [ci skip]
* 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
2014-07-28 11:28:55 +00:00
akr 95de2b0012 * internal.h (struct RBignum): Use size_t for len.
* 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
2014-04-19 01:11:04 +00:00
akr a6024cdc1b * numeric.c (rb_num2long): Returns a long.
(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
2014-04-18 15:46:32 +00:00
akr 9aa67e267b * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.
* 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
2014-04-13 03:48:17 +00:00
nobu 3008ea2872 bignum.c: adjust condtions
* 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
2014-03-14 01:27:44 +00:00
nobu fc23374f06 [DOC] add links to `Object#hash`
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
2014-03-14 01:27:43 +00:00
nobu cc216f9aae adjust indent and style
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-27 07:10:14 +00:00
mame f67e09c7fd * bignum.c (bary_mul_precheck): fix a copy-paste error.
Coverity Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 16:23:58 +00:00
akr 3c99764bcd * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
(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
2014-02-15 21:17:34 +00:00
akr dfd26e3a47 * bignum.c (rb_big_cmp): Avoid bignum allocation for comparison
between bignum and fixnum.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 02:48:44 +00:00
akr 6f8b0e9bb0 * include/ruby/intern.h,
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
2014-02-14 15:16:31 +00:00
akr 2fee22f30d [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-11 16:40:41 +00:00
akr c1de2f4e3a * bignum.c (rb_big_cmp): Specialize a comparison to zero.
* 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
2014-02-11 14:43:23 +00:00
akr bc65d709ab * bignum.c (bigxor_int): Apply BIGLO for long in a BDIGIT expression.
(bigor_int): Ditto.
  (bigand_int): Ditto.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24 13:27:14 +00:00
akr d33541009f * include/ruby/defines.h: Don't use int128_t for Bignum.
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
2013-11-24 04:51:33 +00:00
nobu ef37d178bb bignum.c: suppress warning
* 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
2013-11-19 14:00:26 +00:00
nobu e146015272 bignum.c, math.c: RB_BIGNUM_TYPE_P
* 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
2013-09-07 19:04:23 +00:00
nobu c26293dccf bignum.c, math.c: type predicates
* 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
2013-09-07 19:04:18 +00:00
nobu a77ae1eced bignum.c: split rb_big_fdiv and big_fdiv
* 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
2013-09-07 19:04:15 +00:00
akr b1b395911c * bignum.c (GMP_DIV_DIGITS): New macro.
(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
2013-09-04 23:22:27 +00:00
akr 3b1ab2a6b7 * bignum.c (bary_divmod_normal): Reduce temporary array allocations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 21:23:21 +00:00
akr 8745bc676e * bignum.c (rb_big_divrem_normal): Add GC guards.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 17:21:43 +00:00
akr 8f8bf8243d * bignum.c (rb_big_divrem_normal): New function.
* 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
2013-09-04 16:10:06 +00:00
akr cf3736a75a * bignum.c (bigdivrem_normal): Removed.
(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
2013-09-04 15:10:48 +00:00
akr 102a2c2e80 * bignum.c (bigdivrem): Useless declaration removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 14:03:29 +00:00
akr dd95c9b1cd * bignum.c (bigdivrem_normal): Add assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-04 11:23:05 +00:00
akr 2583689340 * bignum.c (GMP_STR2BIG_DIGITS): New macro.
(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
2013-09-03 11:20:02 +00:00
akr 0b2413b471 * bignum.c (rb_str2big_poweroftwo): New function.
(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
2013-09-03 03:50:15 +00:00
akr c048ad23b6 * bignum.c (str2big_scan_digits): Extracted from rb_cstr_to_inum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-03 03:03:32 +00:00
akr 0c3d124571 * bignum.c (bytes_2comp): Define it only for little endian
environment.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02 22:41:07 +00:00
akr 1d7611ff48 * bignum.c (ISDIGIT): Unused macro removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02 13:56:23 +00:00
akr 5f61a592e9 * bignum.c (str2big_poweroftwo): Extracted from rb_cstr_to_inum.
(str2big_normal): Ditto.
  (str2big_karatsuba): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02 13:52:05 +00:00
akr 0effd06122 * bignum.c (Init_Bignum): Define Bignum::GMP_VERSION when GMP is used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 22:04:35 +00:00
akr c48e169fb9 * bignum.c (big2str_generic): Reduce arguments.
(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
2013-09-01 16:47:20 +00:00
akr b64c2c348f * bignum.c (GMP_BIG2STR_DIGITS): New constant.
(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
2013-09-01 14:34:53 +00:00
akr 4dd7a13a0a * bignum.c (bary_mul_gmp): Use mpz_init and mpz_clear instead of
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
2013-09-01 13:38:49 +00:00
akr 7dd1604603 * bignum.c (big2str_base_poweroftwo): Renamed from
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
2013-09-01 11:35:57 +00:00
akr 34004844cd * bignum.c (big2str_2bdigits): Renamed from big2str_orig.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 06:21:52 +00:00
akr 6fe40011a8 * bignum.c: Remove BITSPERDIG >= INT_MAX test. The static assertion,
SIZEOF_BDIGITS <= sizeof(BDIGIT) is enough.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 04:03:32 +00:00
akr c9b3571ceb * bignum.c (maxpow_in_bdigit): Removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 02:39:05 +00:00
akr 77f245e62e * numeric.c (rb_fix_bit_length): Moved from bignum.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 01:31:16 +00:00
akr a0a0b61b68 [DOC]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-01 01:00:15 +00:00