summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-13 05:12:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-13 05:12:01 +0000
commit1ea1d2e4a7911f5c43fdea2daadc2ea9201d4a4d (patch)
tree53a7e35fbe77b0039f0c4c1955fb6ee81bfe2e21 /bignum.c
parent9d258137458ddabeeeb99882022b4da5c54e645c (diff)
downloadbundler-1ea1d2e4a7911f5c43fdea2daadc2ea9201d4a4d.tar.gz
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
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/bignum.c b/bignum.c
index a6d669e887..e46f845c57 100644
--- a/bignum.c
+++ b/bignum.c
@@ -6906,6 +6906,12 @@ rb_big_abs(VALUE x)
return x;
}
+size_t
+rb_big_size(VALUE big)
+{
+ return BIGSIZE(big);
+}
+
/*
* call-seq:
* big.size -> integer
@@ -6919,9 +6925,9 @@ rb_big_abs(VALUE x)
*/
static VALUE
-rb_big_size(VALUE big)
+rb_big_size_m(VALUE big)
{
- return SIZET2NUM(BIGSIZE(big));
+ return SIZET2NUM(rb_big_size(big));
}
/*
@@ -7087,7 +7093,7 @@ Init_Bignum(void)
rb_define_method(rb_cBignum, "===", rb_big_eq, 1);
rb_define_method(rb_cBignum, "abs", rb_big_abs, 0);
rb_define_method(rb_cBignum, "magnitude", rb_big_abs, 0);
- rb_define_method(rb_cBignum, "size", rb_big_size, 0);
+ rb_define_method(rb_cBignum, "size", rb_big_size_m, 0);
rb_define_method(rb_cBignum, "bit_length", rb_big_bit_length, 0);
#ifdef USE_GMP