/* This software is licensed by the Apache License 2.0, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ #include #include #include "../../include/vtype.h" #define is_integer(t) ((t) <= VTYPE_INT64) #define is_float(t) ((t) >= VTYPE_FLOAT && (t) <= VTYPE_LDOUBLE) #define is_iterable(t) ((t) >= VTYPE_MAP) #ifndef NDEBUG # define type_assert(t0, t1) assert((t0) == (t1)) # define tvalue_assert(t) assert(is_integer(t)) # define tfloat_assert(t) assert(is_float (t)) # define expr_assert(expr) assert(expr) #else # define type_assert(t0, t1) if ( (t0) != (t1)) abort() # define tvalue_assert(t) if (!is_integer(t)) abort() # define tfloat_assert(t) if (!is_float (t)) abort() # define expr_assert(expr) expr #endif