nobu
ffa371d9aa
numeric.c: limit return value
...
* numeric.c (num_equal): limit return value to true or false,
instead of the result of the other as-is.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 02:04:51 +00:00
nobu
97803e2250
purge id_eqeq_p
...
* rational.c (f_{eqeq,zero,one,minus_one}_p, nurat_eqeq_p): use
rb_equal. this function returns Qtrue or Qfalse always, so it
is safe to cast down to int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-13 01:51:29 +00:00
mrkn
b027b019ef
complex.c: refactoring
...
* complex.c: refactor to use some specific macros and
to reduce needless conversion by FIX2LONG.
* complex.c (k_fixnum_p, k_bignum_p): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 18:42:30 +00:00
mrkn
b5be78c6bf
rational.c: refactoring
...
* rational.c: use RB_INTEGER_TYPE_P, RB_FLOAT_TYPE_P, and FIXNUM_ZERO_P.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 16:29:11 +00:00
mrkn
e7a7583029
rational.c: remove f_negative_p
...
* rational.c (f_negative_p): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:43:34 +00:00
mrkn
bdd18a2c31
rational.c: optimize Integer#lcm
...
* rational.c (f_div, f_mul, f_abs): optimize Integer#lcm
Author: Tadashi Saito <tad.a.digger@gmail.com>
* numeric.c (rb_int_abs): rename from int_abs to be exported.
* internal.h (rb_int_div, rb_int_abs): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:43:26 +00:00
mrkn
edfa67c248
rational.c: optimize (-rational).rationalize(some)
...
* rational.c (nurat_rationalize): optimize (-rational).rationalize(some).
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:43:18 +00:00
svn
f3364f711e
* 2016-11-13
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:07:53 +00:00
mrkn
a36d273eab
rational.c: define Rational#{negative?,positive?}
...
* rational.c (nurat_{negative,positive}_p): define Rational#negative?
and Rational#positive?, respectively.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 15:07:53 +00:00
mrkn
189ba5e0ac
rational.c: refactoring
...
* rational.c (id_expt, id_fdiv, f_expt, f_fdiv, f_positive_p): removed.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 14:54:19 +00:00
nobu
c62ab010c8
test_fstring.rb: fix exception
...
* test/-ext-/string/test_fstring.rb (test_singleton_class): fix
expected exception class. [ruby-dev:49867] [Bug #12923 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 13:24:23 +00:00
mrkn
cc376ee210
raitonal.c: remove needless macro
...
* rational.c (id_lshift, f_lshift): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 12:16:12 +00:00
mrkn
bdfd436f78
rational.c: optimize Float#rationalize
...
* rational.c (rb_flt_rationalize{,_with_prec},float_rationalize):
optimize Float#rationalize.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 12:14:10 +00:00
mrkn
81f16bf32f
rational.c: use rb_num_zerodiv instead of rb_raise_zerodiv
...
* rational.c (rb_raize_zerodiv): replace by rb_num_zerodiv.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 11:52:09 +00:00
mrkn
f40607d15d
rational.c: optimize Float#to_r
...
* rational.c (float_to_r): optimize Float#to_r.
* numeric.c (rb_int_lshift): exported.
* internal.h (rb_int_lshift): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 11:52:00 +00:00
mrkn
ffa2b0061f
rational.c: optimize Float#{numerator,denominator}
...
* rational.c (float_{numerator,denominator}): optimize
Float#{numerator,denominator}.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 11:51:51 +00:00
mrkn
ea5b76a079
rational.c: optimize Numeric#quo
...
* rational.c (numeric_quo): optimize Numeric#quo.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 11:51:41 +00:00
nobu
ee160e68f9
class.c: no fstring singleton class
...
* class.c (singleton_class_of): prohibit fstrings from creating
singleton classes.
temporary measure for [ruby-dev:49867] [Bug #12923 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 09:43:05 +00:00
nobu
2c0d3e2a2e
symbol/noninterned_name.rb
...
* test/-ext-/symbol/noninterned_name.rb: split from
test_inadvertent_creation.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 08:16:58 +00:00
mrkn
04e83c536e
rational.c: refactor by removing needless ID vars
...
* rational.c (id_cmp, id_trunate): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 07:32:28 +00:00
mrkn
af070554e8
rational.c: optimize Rational#fdiv
...
* rational.c (nurat_fdiv): optimize Rational#fdiv.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* rational.c (f_to_f, id_to_f): removed.
* rational.c (f_expt): only used when FLT_RADIX is not 2.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 07:28:47 +00:00
mrkn
05ff2fe4f3
rational.c: optimize Rational#to_i
...
* rational.c (nurat_truncate): optimize Rational#to_i.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:58:35 +00:00
mrkn
9bb3022475
rational.c: optimize Rational#{floor,ceil,round,truncate}
...
* rational.c (f_{expt10,round_common},nurat_{floor,ceil,round_half_{up,even}}):
optimize Rational#{floor,ceil,round,truncate}.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* numeric.c (rb_int_divmod): rename from int_divmod to be exported.
* numeric.c (rb_int_and): rename from int_and to be exported.
* intern.h (rb_int_{divmod,and}): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:45:11 +00:00
mrkn
a5160c5051
rational.c: optimize rational.coerce(float) and float [+-*/] rational
...
* rational.c (nurat_coerce): optimize rational.coerce(float).
note that this makes `float [+-*/] rational` faster
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:17:12 +00:00
nobu
0913d67f5d
pack.c: simplify
...
* pack.c (str_associate): remove unnecessary branch.
the argument must be a plain vanilla string object.
* pack.c (str_associated): use rb_ivar_lookup to give the
undefined value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:12:13 +00:00
nobu
4e41467894
class.c: trivial optimization
...
* class.c (singleton_class_of): just copy FROZEN flag without
conditions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:12:12 +00:00
nobu
c937bd4a92
.gdbinit: improve rp [ci skip]
...
* .gdbinit (rp): improve T_OBJECT dump. show the contents of the
instance variables table.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:12:09 +00:00
mrkn
7e7778f80b
rational.c: optimize construction of Rational
...
* rational.c (nurat_{s_new_bang,canonicalize,f_rational,s_convert}):
optimize construction of Rational from numbers.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* rational.c (read_{num,rat_nos}): optimize construction of Rational
from string.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:07:46 +00:00
mrkn
e5aa590637
rational.c: purge f_cmp
...
* rational.c (f_cmp, nurat_expt): purge f_cmp.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* rational.c (INT_POSITIVE_P): added.
* numeric.c (FIXNUM_POSITIVE_P): move the definition into internal.h.
* internal.h (FIXNUM_POSITIVE_P): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:07:24 +00:00
mrkn
2e9357e7ea
rational.c: optimize Rational#-@
...
* rational.c (nurat_negate): introduced to optimize Rational#-@.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 06:07:01 +00:00
mrkn
d611a7c77b
rational.c: optimize Rational#==
...
* rational.c (nurat_eqeq_p): optimize Rational#==.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* numeric.c (rb_int_equal): rename from int_equal and remove static
to be exported.
* internal.h (rb_int_equal): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 02:24:32 +00:00
mrkn
fb40c3776a
rational.c: optimize Rational#<=>
...
* rational.c (nurat_cmp): optimize Rational#<=>.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* numeric.c (rb_int_cmp): rename from int_cmp and remove static
to be exported.
* internal.h (rb_int_cmp): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 01:29:01 +00:00
mrkn
d8769bffe5
rational.c: optimize Rational#**
...
* rational.c (nurat_expt): optimize Rational#**.
Author: Tadashi Saito <tad.a.digger@gmail.com>
* numeric.c (rb_float_pow): rename flo_pow() to rb_float_pow()
and remove static to be exporetd.
* internal.h (rb_int_pow, rb_float_pow): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 16:38:28 +00:00
mrkn
75bf28bb42
rational.c: add argument type check assertions in f_muldiv
...
* rational.c (f_muldiv): add assertions to check argument types
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 16:18:13 +00:00
mrkn
bc4310718b
rational.c: optimize Rational#/
...
* rational.c (f_muldiv, nurat_div): optimize Rational#/.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 16:17:56 +00:00
mrkn
06d701a1f0
rational.c: avoid needless object allocation with nurat_to_double
...
* rational.c (nurat_to_double): introduce to convert rational to double
without object allocation.
* rational.c (rb_rational_plus, nurat_{sub,mul,to_f}): rewrite by using
nurat_to_double.
* bignum.c (rb_big_fdiv_double): introduce to calculate fdiv and return
the result as a double value.
* bignum.c (big_fdiv{,_int,_float}): change the return types for
implementing rb_big_fdiv_double.
* bignum.c (rb_big_fdiv): rewrite by using rb_big_fdiv_double.
* numeric.c (rb_int_fdiv_double): introduce to calculate fdiv and return
the result as a double value.
* numeric.c (fix_fdiv_double): rewrite from fix_fdiv to return the
result as a double value.
* numeric.c (rb_int_fdiv): rewrite by using rb_int_fdiv_double.
* internal.h (rb_{big,int}_fdiv_double): exported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 15:55:30 +00:00
nagachika
6feb1684f3
fix a constant name typo in redmine-backporter.rb
...
[ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 15:43:43 +00:00
svn
a0f1c77adc
* 2016-11-12
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 15:11:05 +00:00
mrkn
8fd00809a7
rational.c: optimize rational * {float, huge rational, bignum}
...
* rational.c (f_muldiv, nurat_mul):
optimize rational * {float, huge rational, bignum}.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 15:11:04 +00:00
mrkn
86ec117881
rational.c: optimize rational - {float,rational}
...
* rational.c (f_addsub, nurat_sub): optimize rational - {float,rational}.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:57:11 +00:00
mrkn
b848f3c7e1
rational.c: optimize rational - integer
...
* rational.c (nurat_sub): optimize rational - integer.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:45:11 +00:00
mrkn
d028d6984f
rational.c: optimize rational + rational
...
* rational.c (f_addsub): optimize rational + rational.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:42:53 +00:00
mrkn
268203c5fc
rational.c: prevent unused warning
...
* rational.c (f_mod): define only when NDEBUG is not defined to prevent
unused warning
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:39:34 +00:00
mrkn
f64a53462e
numeric.c, rational.c: refactor by using FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P
...
* numeric.c (num_zero_p, fix_divide, fix_mod, fix_divmod): refactor by using
FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P.
* rational.c (INT_NEGATIVE_P, INT_ZERO_P): ditto.
* internal.h: move FIXNUM_NEGATIVE_P and FIXNUM_ZERO_P from numeric.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:39:25 +00:00
mrkn
8ee8c5eeb6
rational.c: optimize Integer#gcd.
...
* rational.c (f_gcd_normal): optimize Integer#gcd.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:39:16 +00:00
mrkn
dae15fa0d4
rational.c: optimize rational + integer.
...
* rational.c (rb_rational_plus): optimize rational + integer.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:39:07 +00:00
mrkn
70f5ad7c41
rational.c: optimize rational + float.
...
* rational.c (rb_rational_plus): optimize rational + float.
Author: Tadashi Saito <tad.a.digger@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 14:38:59 +00:00
nobu
54bc0a446d
range.c: check loading
...
* range.c (range_loader): check loading values if the data came
from an initialized range object. [ruby-core:78067] [Bug #12915 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 11:52:03 +00:00
nobu
e41ebc50dc
rational.c: check load
...
* rational.c (nurat_loader, nurat_marshal_load): check if loading
values are Integer. [ruby-core:78071] [Bug #12918 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 07:26:14 +00:00
nobu
0f9ce57b86
rational.c: optimize
...
* rational.c (f_{lt,eqeq,zero,one,minus_one,kind_of}_p): add RTEST
to results of funcalls.
* rational.c (f_negative_p, k_{integer,float,rational}_p):
optimize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-11 07:08:53 +00:00