Add mrb_true_p() and mrb_false_p() macro functions

This commit is contained in:
dearblue
2019-04-19 22:50:05 +09:00
parent 05f65d2d42
commit 125c3bef19
2 changed files with 8 additions and 0 deletions
+6
View File
@@ -157,6 +157,12 @@ typedef void mrb_value;
#ifndef mrb_nil_p
#define mrb_nil_p(o) (mrb_type(o) == MRB_TT_FALSE && !mrb_fixnum(o))
#endif
#ifndef mrb_false_p
#define mrb_false_p(o) (mrb_type(o) == MRB_TT_FALSE && !!mrb_fixnum(o))
#endif
#ifndef mrb_true_p
#define mrb_true_p(o) (mrb_type(o) == MRB_TT_TRUE)
#endif
#ifndef mrb_bool
#define mrb_bool(o) (mrb_type(o) != MRB_TT_FALSE)
#endif