diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-05 01:20:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-05 01:20:20 +0000 |
commit | 4a429c11e1319b0e13368851454f109217ab5de5 (patch) | |
tree | e2db37bfebe9446a88399aef251d474eb9418295 /numeric.c | |
parent | ce357ef152869d3c5bfd2e088a31d879daa4ecb6 (diff) | |
download | ruby-4a429c11e1319b0e13368851454f109217ab5de5.tar.gz |
enumerator.c: allow Bignum for with_index
* enumerator.c (enumerator_with_index_i): allow Bignum as offset, to
get rid of conversion exception and integer overflow.
[ruby-dev:47131] [Bug #8010]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -2383,8 +2383,8 @@ fix_succ(VALUE num) * (-1).next #=> 0 */ -static VALUE -int_succ(VALUE num) +VALUE +rb_int_succ(VALUE num) { if (FIXNUM_P(num)) { long i = FIX2LONG(num) + 1; @@ -2396,6 +2396,8 @@ int_succ(VALUE num) return rb_funcall(num, '+', 1, INT2FIX(1)); } +#define int_succ rb_int_succ + /* * call-seq: * int.pred -> integer @@ -2406,8 +2408,8 @@ int_succ(VALUE num) * (-1).pred #=> -2 */ -static VALUE -int_pred(VALUE num) +VALUE +rb_int_pred(VALUE num) { if (FIXNUM_P(num)) { long i = FIX2LONG(num) - 1; @@ -2419,6 +2421,8 @@ int_pred(VALUE num) return rb_funcall(num, '-', 1, INT2FIX(1)); } +#define int_pred rb_int_pred + VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc) { |