new macro mrb_int(mrb,x) to retrieve mrb_int from mrb_value with conversion if needed

parent 1519e441
......@@ -381,6 +381,7 @@ mrb_value mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const
void mrb_gc_protect(mrb_state *mrb, mrb_value obj);
mrb_value mrb_to_int(mrb_state *mrb, mrb_value val);
#define mrb_int(mrb, val) mrb_fixnum(mrb_to_int(mrb, val))
void mrb_check_type(mrb_state *mrb, mrb_value x, enum mrb_vtype t);
typedef enum call_type {
......
......@@ -242,8 +242,8 @@ range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb
if (mrb_type(range) != MRB_TT_RANGE) return FALSE;
beg = b = mrb_fixnum(mrb_to_int(mrb, r->edges->beg));
end = e = mrb_fixnum(mrb_to_int(mrb, r->edges->end));
beg = b = mrb_int(mrb, r->edges->beg);
end = e = mrb_int(mrb, r->edges->end);
if (beg < 0) {
beg += len;
......
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