diff --git a/include/picrin/value.h b/include/picrin/value.h index 628259fc..69bf2139 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -50,14 +50,21 @@ typedef struct { pic_sym sym; char c; }; - unsigned int type_; + uint32_t type_; }; } u; } pic_value; -#define pic_ptr(v) ((void *)((long long)0xffffffffffff & (long long)(v).u.data)) -#define pic_vtype(v) (((unsigned)0xfff00000 >= (v).u.type_) ? PIC_VTYPE_FLOAT : (((v).u.type_ & 0xf0000)>>16)) -#define pic_init_value(v,vtype) (((v).u.type_ = ((unsigned int)0xfff00000|(unsigned int)((vtype)<<16))), (v).u.i = 0) +#define pic_ptr(v) ((void *)((uint64_t)0xffffffffffff & (uint64_t)(v).u.data)) +#define pic_init_value(v,vtype) (((v).u.type_ = (((uint32_t)0xfff00000)|((uint32_t)((vtype)<<16)))), (v).u.i = 0) + +static inline enum pic_vtype +pic_vtype(pic_value v) +{ + return 0xfff00000 >= v.u.type_ + ? PIC_VTYPE_FLOAT + : (v.u.type_ & 0xf0000)>>16; +} #else