Skip to content

Commit

Permalink
NaN boxing: use uintptr_t for bit manipulations
Browse files Browse the repository at this point in the history
  • Loading branch information
cremno committed Jan 2, 2014
1 parent e8dd818 commit 16c5cf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/mruby/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ typedef struct mrb_value {
#define mrb_tt(o) (((o).value.ttt & 0xfc000)>>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_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_SET_VALUE(o, tt, attr, v) do {\
Expand All @@ -166,7 +166,7 @@ typedef struct mrb_value {
case MRB_TT_UNDEF:\
case MRB_TT_FIXNUM:\
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)

Expand Down

0 comments on commit 16c5cf9

Please sign in to comment.