Use memcmp() in value_is_equal()

This commit is contained in:
Rodrigo Arias 2023-03-10 09:40:22 +01:00 committed by Rodrigo Arias Mallo
parent 2442d5decb
commit 6c7b64f7f2

View File

@ -27,17 +27,7 @@ struct value {
static inline int static inline int
value_is_equal(struct value *a, struct value *b) value_is_equal(struct value *a, struct value *b)
{ {
if (a->type != b->type) return memcmp(a, b, sizeof(struct value)) == 0;
return 0;
if (a->type == VALUE_INT64 && a->i == b->i)
return 1;
else if (a->type == VALUE_DOUBLE && a->d == b->d)
return 1;
else if (a->type == VALUE_NULL && b->type == VALUE_NULL)
return 1;
else
return 0;
} }
static inline struct value static inline struct value