mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
object.c: add new function mrb_ensure_integer_type().
that checks if the value is an `Integer` which may be a big integer, where existing `mrb_ensure_int_type()` checks if the value is an Integer **and** fits in `mrb_int`.
This commit is contained in:
@@ -1406,6 +1406,9 @@ MRB_API mrb_value mrb_check_string_type(mrb_state *mrb, mrb_value str);
|
||||
#define mrb_to_str(mrb, str) mrb_ensure_string_type(mrb,str)
|
||||
/* obsolete: use mrb_obj_as_string() instead */
|
||||
#define mrb_str_to_str(mrb, str) mrb_obj_as_string(mrb, str)
|
||||
/* check if val is an integer (including Bigint) */
|
||||
MRB_API mrb_value mrb_ensure_integer_type(mrb_state *mrb, mrb_value val);
|
||||
/* check if val fit in mrb_int */
|
||||
MRB_API mrb_value mrb_ensure_int_type(mrb_state *mrb, mrb_value val);
|
||||
#define mrb_as_int(mrb, val) mrb_integer(mrb_ensure_int_type(mrb, val))
|
||||
/* obsolete: use mrb_ensure_int_type() instead */
|
||||
|
||||
Reference in New Issue
Block a user