summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-numeric-ext/src/numeric_ext.c
diff options
context:
space:
mode:
authorKOBAYASHI Shuji <[email protected]>2019-08-04 22:02:39 +0900
committerKOBAYASHI Shuji <[email protected]>2019-08-04 22:02:39 +0900
commitd599e35aa4adcf25aeaa434c60138a33b91ed88a (patch)
tree480385c6ad5319da7a15b486e5b17b42061a5f69 /mrbgems/mruby-numeric-ext/src/numeric_ext.c
parentf6c41c186200e54eaf5d25d301d945570a829f55 (diff)
downloadmruby-d599e35aa4adcf25aeaa434c60138a33b91ed88a.tar.gz
mruby-d599e35aa4adcf25aeaa434c60138a33b91ed88a.zip
Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`
Diffstat (limited to 'mrbgems/mruby-numeric-ext/src/numeric_ext.c')
-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 86c384a87..e54239365 100644
--- a/mrbgems/mruby-numeric-ext/src/numeric_ext.c
+++ b/mrbgems/mruby-numeric-ext/src/numeric_ext.c
@@ -1,13 +1,6 @@
#include <limits.h>
#include <mruby.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
@@ -20,7 +13,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);
}
@@ -36,7 +29,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);
}
@@ -52,7 +45,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);
}