summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-numeric-ext
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-08-05 12:33:59 +0900
committerGitHub <[email protected]>2019-08-05 12:33:59 +0900
commit96ce4563bd7d8cb44ff2eb8038ed74279d33e442 (patch)
treea283de68fcd7c36e51ae2214bb1ec34d54cd608a /mrbgems/mruby-numeric-ext
parent0e2e8b79d327da9b2ba0ce42e02cf6653c3e3fae (diff)
parentd599e35aa4adcf25aeaa434c60138a33b91ed88a (diff)
downloadmruby-96ce4563bd7d8cb44ff2eb8038ed74279d33e442.tar.gz
mruby-96ce4563bd7d8cb44ff2eb8038ed74279d33e442.zip
Merge pull request #4614 from shuujii/use-mrb_int-instead-of-to_int-in-mruby-numeric-ext
Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`
Diffstat (limited to 'mrbgems/mruby-numeric-ext')
-rw-r--r--mrbgems/mruby-numeric-ext/src/numeric_ext.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/mrbgems/mruby-numeric-ext/src/numeric_ext.c b/mrbgems/mruby-numeric-ext/src/numeric_ext.c
index 16560fe86..f8aff54bc 100644
--- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c
+++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c
@@ -2,13 +2,6 @@
#include <mruby.h>
#include <mruby/numeric.h>
-static inline mrb_int
-to_int(mrb_state *mrb, mrb_value x)
-{
- x = mrb_to_int(mrb, x);
- return mrb_fixnum(x);
-}
-
/*
* call-seq:
* int.allbits?(mask) -> true or false
@@ -21,7 +14,7 @@ mrb_int_allbits(mrb_state *mrb, mrb_value self)
mrb_int n, m;
mrb_get_args(mrb, "i", &m);
- n = to_int(mrb, self);
+ n = mrb_int(mrb, self);
return mrb_bool_value((n & m) == m);
}
@@ -37,7 +30,7 @@ mrb_int_anybits(mrb_state *mrb, mrb_value self)
mrb_int n, m;
mrb_get_args(mrb, "i", &m);
- n = to_int(mrb, self);
+ n = mrb_int(mrb, self);
return mrb_bool_value((n & m) != 0);
}
@@ -53,7 +46,7 @@ mrb_int_nobits(mrb_state *mrb, mrb_value self)
mrb_int n, m;
mrb_get_args(mrb, "i", &m);
- n = to_int(mrb, self);
+ n = mrb_int(mrb, self);
return mrb_bool_value((n & m) == 0);
}