Commit 16c5cf92 authored by cremno's avatar cremno

NaN boxing: use uintptr_t for bit manipulations

parent e8dd8180
...@@ -155,7 +155,7 @@ typedef struct mrb_value { ...@@ -155,7 +155,7 @@ typedef struct mrb_value {
#define mrb_tt(o) (((o).value.ttt & 0xfc000)>>14) #define mrb_tt(o) (((o).value.ttt & 0xfc000)>>14)
#define mrb_mktt(tt) (0xfff00000|((tt)<<14)) #define mrb_mktt(tt) (0xfff00000|((tt)<<14))
#define mrb_type(o) ((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT) #define mrb_type(o) ((uint32_t)0xfff00000 < (o).value.ttt ? mrb_tt(o) : MRB_TT_FLOAT)
#define mrb_ptr(o) ((void*)((((intptr_t)0x3fffffffffff)&((intptr_t)((o).value.p)))<<2)) #define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)((o).value.p)))<<2))
#define mrb_float(o) (o).f #define mrb_float(o) (o).f
#define MRB_SET_VALUE(o, tt, attr, v) do {\ #define MRB_SET_VALUE(o, tt, attr, v) do {\
...@@ -166,7 +166,7 @@ typedef struct mrb_value { ...@@ -166,7 +166,7 @@ typedef struct mrb_value {
case MRB_TT_UNDEF:\ case MRB_TT_UNDEF:\
case MRB_TT_FIXNUM:\ case MRB_TT_FIXNUM:\
case MRB_TT_SYMBOL: (o).attr = (v); break;\ case MRB_TT_SYMBOL: (o).attr = (v); break;\
default: (o).value.i = 0; (o).value.p = (void*)((intptr_t)(o).value.p | (((intptr_t)(v))>>2)); break;\ default: (o).value.i = 0; (o).value.p = (void*)((uintptr_t)(o).value.p | (((uintptr_t)(v))>>2)); break;\
}\ }\
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment