akr
c19c8ef4ae
[DOC]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 13:05:22 +00:00
akr
8248c26e6d
Define Integer#/ instead of Bignum#/.
...
* numeric.c (rb_int_div): Define Integer#/.
* bignum.c (rb_big_div): Don't define Bignum#/.
* lib/mathn.rb (Integer#/): Replace Integer#/ instead of Bignum#/.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 12:39:53 +00:00
akr
d0e2d150b8
Define Integer#+ instead of Bignum#+.
...
* numeric.c (rb_int_plus): Define Integer#+.
* bignum.c (rb_big_plus): Don't define Bignum#+.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 12:24:06 +00:00
akr
11ca96d3a3
Define Integer#- instead of Bignum#-.
...
* numeric.c (rb_int_minus): Define Integer#-.
* bignum.c (rb_big_minus): Don't define Bignum#-.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 12:09:31 +00:00
akr
a9f3a1cda1
Define Integer#* instead of Bignum#*.
...
* numeric.c (rb_int_mul): Define Integer#*.
* bignum.c (rb_big_mul): Don't define Bignum#*.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 11:54:26 +00:00
akr
e27a06f4bb
Define Integer#% instead of Bignum#%.
...
* numeric.c (rb_int_modulo): Define Integer#%.
* bignum.c (rb_big_modulo): Don't define Bignum#%.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 11:31:28 +00:00
akr
25f2c85066
Define Integer#== instead of Bignum#==.
...
* numeric.c (int_equal): Define Integer#==.
* bignum.c (rb_big_eq): Don't define Bignum#==.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 11:18:00 +00:00
akr
70279a5700
Define Integer#> instead of Bignum#>.
...
* numeric.c (int_gt): Define Integer#>.
* bignum.c (rb_big_gt): Don't define Bignum#>.
Renamed from big_gt.
* internal.h (rb_big_gt): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 10:42:06 +00:00
akr
289c3f40a1
Define Integer#>= instead of Bignum#>=.
...
* numeric.c (int_ge): Define Integer#>=.
* bignum.c (rb_big_ge): Don't define Bignum#>=.
Renamed from big_ge.
* internal.h (rb_big_ge): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 10:26:17 +00:00
akr
6b16db9c80
Define Integer#< instead of Bignum#<.
...
* numeric.c (int_lt): Define Integer#<.
* bignum.c (rb_big_lt): Don't define Bignum#<.
Renamed from big_lt.
* internal.h (rb_big_lt): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 10:10:23 +00:00
akr
d00bca92a9
Define Integer#<= instead of Bignum#<=.
...
* numeric.c (int_le): Define Integer#<=.
* bignum.c (rb_big_le): Don't define Bignum#<=.
Renamed from big_le.
* internal.h (rb_big_le): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 09:48:25 +00:00
akr
d13774e23f
Define Integer#GMP_VERSION.
...
* bignum.c (Init_Bignum): Define Integer#GMP_VERSION.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 09:12:11 +00:00
akr
635cff451f
Define Integer#remainder instead of Bignum#remainder.
...
* numeric.c (int_remainder): Define Integer#remainder.
* bignum.c (rb_big_remainder): Don't define Bignum#remainder.
* internal.h (rb_big_remainder): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 08:27:30 +00:00
akr
ae225a2ca8
{Fixnum,Bignum}#-@ is unified into Integer.
...
* numeric.c (rb_int_uminus): {Fixnum,Bignum}#-@ is unified into
Integer.
* bignum.c (rb_big_uminus): Don't define Bignum#-@.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 06:30:08 +00:00
akr
73dd745cf1
{Fixnum,Bignum}#div is unified into Integer.
...
* numeric.c (rb_int_idiv): {Fixnum,Bignum}#div is unified into
Integer.
* bignum.c (rb_big_idiv): Don't define Bignum#div.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 05:43:15 +00:00
akr
728333dcd3
{Fixnum,Bignum}#modulo is unified into Integer.
...
* numeric.c (rb_int_modulo): {Fixnum,Bignum}#modulo is unified into
Integer.
* bignum.c (rb_big_modulo): Don't define Bignum#modulo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 05:26:52 +00:00
akr
1b1a1ed6c8
{Fixnum,Bignum}#divmod is unified into Integer.
...
* numeric.c (int_divmod): {Fixnum,Bignum}#divmod is unified into
Integer.
* bignum.c (rb_big_divmod): Don't define Bignum#divmod.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 05:05:54 +00:00
akr
27f9556de9
{Fixnum,Bignum}#fdiv is unified into Integer.
...
* numeric.c (int_fdiv): {Fixnum,Bignum}#fdiv is unified into
Integer.
* bignum.c (rb_big_fdiv): Don't define Bignum#fdiv.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 04:20:56 +00:00
akr
8a2df1ce3f
{Fixnum,Bignum}#** is unified into Integer.
...
* numeric.c (rb_int_pow): {Fixnum,Bignum}#** is unified into
Integer.
* bignum.c (rb_big_pow): Don't define Bignum#**.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 03:59:02 +00:00
akr
d73b431e50
Rename fix_rev and rb_big_neg to fix_comp and rb_big_comp.
...
* bignum.c (rb_big_comp): Renamed from rb_big_neg.
* numeric.c (fix_comp): Renamed from fix_rev.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 03:30:53 +00:00
akr
10fb4e151d
{Fixnum,Bignum}#~ is unified into Integer.
...
* numeric.c (int_comp): {Fixnum,Bignum}#~ is unified into
Integer.
* bignum.c (rb_big_neg): Don't define Bignum#~.
* internal.h (rb_big_neg): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 03:27:20 +00:00
akr
b296cacb12
{Fixnum,Bignum}#& is unified into Integer.
...
* numeric.c (int_and): {Fixnum,Bignum}#& is unified into
Integer.
* bignum.c (rb_big_and): Don't define Bignum#|.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 03:08:53 +00:00
akr
44af023d44
{Fixnum,Bignum}#| is unified into Integer.
...
* numeric.c (int_or): {Fixnum,Bignum}#| is unified into
Integer.
* bignum.c (rb_big_or): Don't define Bignum#|.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-30 02:54:14 +00:00
akr
f949a95dab
{Fixnum,Bignum}#^ is unified into Integer.
...
* numeric.c (int_xor): {Fixnum,Bignum}#^ is unified into
Integer.
* bignum.c (rb_big_xor): Don't define Bignum#^.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27 15:35:23 +00:00
akr
d5a7299bca
{Fixnum,Bignum}#[] is unified into Integer.
...
* numeric.c (int_aref): {Fixnum,Bignum}#[] is unified into
Integer.
* bignum.c (rb_big_aref): Don't define Bignum#<<.
* internal.h (rb_big_aref): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-27 11:56:03 +00:00
akr
68c661b8e5
[DOC] update Integer#<< doc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 12:29:41 +00:00
akr
06ca50338b
{Fixnum,Bignum}#<< is unified into Integer.
...
* numeric.c (rb_int_lshift): {Fixnum,Bignum}#<< is unified into
Integer.
* bignum.c (rb_big_lshift): Don't define Bignum#<<.
* internal.h (rb_big_lshift): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 12:23:05 +00:00
akr
69fbb21c12
{Fixnum,Bignum}#>> is unified into Integer.
...
* numeric.c (rb_int_rshift): {Fixnum,Bignum}#>> is unified into
Integer.
* bignum.c (rb_big_rshift): Don't define Bignum#>>.
* internal.h (rb_big_rshift): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 12:09:40 +00:00
akr
8f045eddb2
{Fixnum,Bignum}#size is unified into Integer.
...
* numeric.c (int_size): {Fixnum,Bignum}#size is unified into Integer.
* bignum.c (rb_big_size_m): Don't define Bignum#size.
* internal.h (rb_big_size_m): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 11:47:14 +00:00
akr
05bd6f8369
forgot to remove Bignum#bit_length.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 11:30:04 +00:00
akr
bcc1796983
{Fixnum,Bignum}#bit_length is unified into Integer.
...
* numeric.c (rb_int_bit_length): {Fixnum,Bignum}#bit_length is
unified into Integer.
* bignum.c (rb_big_bit_length): Don't define Bignum#bit_length.
* internal.h (rb_big_bit_length): Declared.
--This iine, and those below, will be ignored--
M ChangeLog
M bignum.c
M internal.h
M numeric.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 11:17:37 +00:00
akr
9368d7515b
* numeric.c (int_abs): Integer#{abs,magnitude} moved from Fixnum and Bignum.
...
* internal.h (rb_big_abs): Declared.
* bignum.c (rb_big_abs): Don't define Bignum#{abs,magnitude}.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26 10:59:27 +00:00
nobu
1ea1d2e4a7
numeric.c: int_round_zero_p
...
* bignum.c (rb_big_size): add wrapper function of BIGSIZE and
rename the method funtion with _m suffix.
* numeric.c (int_round_zero_p): extracted from rb_int_round.
optimize for Bignum, and convert VALUE returned by Numeric#size
to long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-13 05:12:01 +00:00
nobu
3b6c4dad0c
bignum.c: rb_cstr_parse_inum
...
* bignum.c (rb_cstr_parse_inum): [EXPERIMENTAL] new function to
parse integer in C-string with length. the name and the
arguments may be changed in the future.
* bignum.c (rb_str_to_inum): preserve encoding of the argument in
error messages, and no longer needs to copy non-terminated
strings.
* bignum.c (rb_str2big_{poweroftwo,normal,karatsuba,gmp}): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-08 17:05:12 +00:00
nobu
45c593d89e
bignum.c: radix check functions
...
* bignum.c (valid_radix_p, invalid_radix): extracted functions to
check radix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-08 08:32:25 +00:00
nobu
57638377cc
bignum.c: micro optimization
...
* bignum.c (rb_big_cmp): micro optimization of Fixnum comparison.
as SIGNED_VALUE and Fixnum have same sign-bits and same order.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-20 10:09:14 +00:00
naruse
a2b4c6d1b1
* bignum.c (rb_big_cmp): reduce the code.
...
* bignum.c (rb_big_eq): If normalized bignum is still bignum,
it must be larger than fixnum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19 19:48:26 +00:00
mrkn
81f65a9e05
* bignum.c (Bignum#<=>): remove it because they are unified with
...
Integer#<=>.
* numeric.c (Integer#<=>, Fixnum#<=>): move <=> method from Fixnum to
Integer.
* numeric.c (int_cmp): add this method for Integer#<=>.
* test/-ext-/integer/test_my_integer.rb (test_my_integer_cmp): add a
test to examine Integer#<=> for unknown subclasses.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19 09:28:12 +00:00
mrkn
0d076fe4b3
* bignum.c (rb_big_to_f, Bignum#to_f): removed them because they are
...
unified with int_to_f and Integer#to_f.
* numeric.c (int_to_f): treat Bignum values directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 15:02:45 +00:00
mrkn
18d114eff2
* bignum.c (Bignum#eql?): remove its definition because it is unified
...
with Numeric#eql?.
* numeric.c (num_eql): treat Bignum values directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 13:11:09 +00:00
mrkn
ad0b5ebc50
* bignum.c (rb_big_to_s, Bignum#to_s): remove its definition because
...
it is unified with Integer#to_s.
* numeric.c (int_to_s): treat Bignum values directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 12:57:40 +00:00
mrkn
f8e79c84a9
* bignum.c (rb_big_hash): make it public function to be available in
...
other source files, and remove documentation comment for Bignum#hash.
* bignum.c (Bignum#hash): remove its definition because it is unified
with Object#hash.
* include/ruby/intern.h (rb_big_hash): add a prototype declaration.
* hash.c (any_hash): treat Bignum values directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 01:22:38 +00:00
mrkn
aa1ea07d37
* bignum.c (Bignum#even?, Bignum#odd?): remove definitions
...
because they are unified with Integer#even? and Integer#odd?.
* numeric.c (Fixnum#zero?, Fixnum#even?, Fixnum#odd?): remove
definitions because they are unified with Numeric#zero?,
Integer#even?, and Integer#odd?.
* numeric.c (num_zero_p, int_even_p, int_odd_p): treat Fixnum and
Bignum values directly.
* test/ruby/test_integer.rb (test_odd_p_even_p): remove meaningless
test case.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:11:42 +00:00
mrkn
a3c9cda6d7
* bignum.c (rb_big_even_p, rb_big_odd_p): make them public functions
...
to be available in other source files.
* include/ruby/intern.h (rb_big_even_p, rb_big_odd_p): add prototype
declarations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-17 17:07:29 +00:00
naruse
3d5a3a236d
* bignum.c (big2str_2bdigits): reduce div instruction.
...
Fix the code so that C compiler unify div instructions of `%` and `/`.
Before:
4291b0: 48 89 f0 mov %rsi,%rax
4291b3: 31 d2 xor %edx,%edx
4291b5: 48 83 ef 01 sub $0x1,%rdi
4291b9: 48 f7 f1 div %rcx # <---- !
4291bc: 41 0f b6 04 11 movzbl (%r9,%rdx,1),%eax
4291c1: 31 d2 xor %edx,%edx
4291c3: 41 88 04 38 mov %al,(%r8,%rdi,1)
4291c7: 48 63 4b 04 movslq 0x4(%rbx),%rcx
4291cb: 48 89 f0 mov %rsi,%rax
4291ce: 48 f7 f1 div %rcx # <---- !
4291d1: 48 89 c6 mov %rax,%rsi
4291d4: 48 85 ff test %rdi,%rdi
4291d7: 75 d7 jne 4291b0 <big2str_2bdigits+0x50>
4291d9: 48 63 6b 10 movslq 0x10(%rbx),%rbp
4291dd: 48 01 6b 20 add %rbp,0x20(%rbx)
4291e1: 48 8b 44 24 48 mov 0x48(%rsp),%rax
4291e6: 64 48 33 04 25 28 00 xor %fs:0x28,%rax
After:
4291b0: 48 63 73 04 movslq 0x4(%rbx),%rsi
4291b4: 31 d2 xor %edx,%edx
4291b6: 48 83 e9 01 sub $0x1,%rcx
4291ba: 48 f7 f6 div %rsi # <---- !
4291bd: 41 0f b6 14 10 movzbl (%r8,%rdx,1),%edx
4291c2: 88 14 0f mov %dl,(%rdi,%rcx,1)
4291c5: 48 85 c9 test %rcx,%rcx
4291c8: 75 e6 jne 4291b0 <big2str_2bdigits+0x50>
4291ca: 48 63 6b 10 movslq 0x10(%rbx),%rbp
4291ce: 48 01 6b 20 add %rbp,0x20(%rbx)
4291d2: 48 8b 44 24 48 mov 0x48(%rsp),%rax
4291d7: 64 48 33 04 25 28 00 xor %fs:0x28,%rax
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14 10:14:48 +00:00
nobu
49079911ba
bignum.c: micro optimization
...
* bignum.c (rb_big_uminus, bigsub_int): use BIGNUM_NEGATE.
* internal.h (BIGNUM_NEGATE): simplify negation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-15 05:15:33 +00:00
nobu
174be80027
use particlar macros
...
* bignum.c: use particlar macros for positive/negative conditions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-15 05:09:59 +00:00
naruse
1f57a334da
* insns.def (opt_mult): Use int128_t for overflow detection.
...
* bignum.c (rb_uint128t2big): added for opt_mult.
* bignum.c (rb_uint128t2big): added for rb_uint128t2big..
* configure.in: define int128_t, uint128_t and related MACROs.
Initially introduced by r41379 but reverted by r50749.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-05 04:31:27 +00:00
nobu
439224a590
RUBY_ASSERT
...
* error.c (rb_assert_failure): assertion with stack dump.
* ruby_assert.h (RUBY_ASSERT): new header for the assertion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-22 08:33:55 +00:00
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