Commit d599e35a authored by KOBAYASHI Shuji's avatar KOBAYASHI Shuji

Use `mrb_int()` instead of `to_int()` in `mruby-numeric-ext`

parent f6c41c18
#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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment