include/value.h (mrb_float_p): define always

even when `MRB_NO_FLOAT` is set. In that case, it is FALSE always.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2022-12-24 19:05:41 +09:00
parent 14f8cf040e
commit 48e5ca4802
4 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -180,6 +180,8 @@ mrb_integer_func(mrb_value o) {
#else
#define mrb_float_p(o) WORDBOX_OBJ_TYPE_P(o, FLOAT)
#endif
#else
#define mrb_float_p(o) FALSE
#endif
#define mrb_array_p(o) WORDBOX_OBJ_TYPE_P(o, ARRAY)
#define mrb_string_p(o) WORDBOX_OBJ_TYPE_P(o, STRING)
@@ -222,9 +224,7 @@ mrb_type(mrb_value o)
mrb_fixnum_p(o) ? MRB_TT_INTEGER :
mrb_symbol_p(o) ? MRB_TT_SYMBOL :
mrb_undef_p(o) ? MRB_TT_UNDEF :
#ifndef MRB_NO_FLOAT
mrb_float_p(o) ? MRB_TT_FLOAT :
#endif
mrb_val_union(o).bp->tt;
}
+3 -1
View File
@@ -245,9 +245,11 @@ struct RCptr {
#ifndef mrb_true_p
#define mrb_true_p(o) (mrb_type(o) == MRB_TT_TRUE)
#endif
#ifndef MRB_NO_FLOAT
#ifndef mrb_float_p
#ifndef MRB_NO_FLOAT
#define mrb_float_p(o) (mrb_type(o) == MRB_TT_FLOAT)
#else
#define mrb_float_p(o) FALSE
#endif
#endif
#ifndef mrb_array_p
-4
View File
@@ -13,10 +13,6 @@
#define ENC_COMP_P(enc, enc_lit) \
str_casecmp_p(RSTRING_PTR(enc), RSTRING_LEN(enc), enc_lit, sizeof(enc_lit"")-1)
#ifdef MRB_NO_FLOAT
# define mrb_float_p(o) FALSE
#endif
static mrb_bool
str_casecmp_p(const char *s1, mrb_int len1, const char *s2, mrb_int len2)
{
+2 -1
View File
@@ -70,7 +70,8 @@ mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2)
}
#endif
#ifdef MRB_USE_BIGINT
if (mrb_bigint_p(obj1) && (mrb_integer_p(obj2) || mrb_bigint_p(obj2))) {
if (mrb_bigint_p(obj1) &&
(mrb_integer_p(obj2) || mrb_bigint_p(obj2) || mrb_float_p(obj2))) {
if (mrb_bint_cmp(mrb, obj1, obj2) == 0)
return TRUE;
return FALSE;