Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
763b39d0
Unverified
Commit
763b39d0
authored
Aug 08, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify `NaN` boxing definitions.
Remove `#ifdef` from `union mrb_value_`.
parent
107c7773
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
include/mruby/boxing_nan.h
include/mruby/boxing_nan.h
+7
-13
No files found.
include/mruby/boxing_nan.h
View file @
763b39d0
...
@@ -41,13 +41,7 @@ union mrb_value_ {
...
@@ -41,13 +41,7 @@ union mrb_value_ {
struct
{
struct
{
MRB_ENDIAN_LOHI
(
MRB_ENDIAN_LOHI
(
uint32_t
ttt
;
uint32_t
ttt
;
,
union
{
,
uint32_t
i
;
mrb_int
i
;
mrb_sym
sym
;
#ifdef MRB_32BIT
void
*
p
;
#endif
};
)
)
};
};
};
};
...
@@ -63,15 +57,15 @@ mrb_val_union(mrb_value v)
...
@@ -63,15 +57,15 @@ mrb_val_union(mrb_value v)
#define mrb_tt(o) ((enum mrb_vtype)((mrb_val_union(o).ttt & 0xfc000)>>14)-1)
#define mrb_tt(o) ((enum mrb_vtype)((mrb_val_union(o).ttt & 0xfc000)>>14)-1)
#define mrb_type(o) (enum mrb_vtype)((uint32_t)0xfff00000 < mrb_val_union(o).ttt ? mrb_tt(o) : MRB_TT_FLOAT)
#define mrb_type(o) (enum mrb_vtype)((uint32_t)0xfff00000 < mrb_val_union(o).ttt ? mrb_tt(o) : MRB_TT_FLOAT)
#define mrb_float(o) mrb_val_union(o).f
#define mrb_float(o) mrb_val_union(o).f
#define mrb_fixnum(o)
mrb_val_union(o).i
#define mrb_fixnum(o)
((mrb_int)mrb_val_union(o).i)
#define mrb_symbol(o)
mrb_val_union(o).sym
#define mrb_symbol(o)
((mrb_sym)mrb_val_union(o).i)
#ifdef MRB_64BIT
#ifdef MRB_64BIT
#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)(mrb_val_union(o).p)))<<2))
#define mrb_ptr(o) ((void*)((((uintptr_t)0x3fffffffffff)&((uintptr_t)(mrb_val_union(o).p)))<<2))
#define mrb_cptr(o) (((struct RCptr*)mrb_ptr(o))->p)
#define mrb_cptr(o) (((struct RCptr*)mrb_ptr(o))->p)
#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
#define BOXNAN_SHIFT_LONG_POINTER(v) (((uintptr_t)(v)>>34)&0x3fff)
#else
#else
#define mrb_ptr(o) (
mrb_val_union(o).p
)
#define mrb_ptr(o) (
(void*)mrb_val_union(o).i
)
#define mrb_cptr(o) mrb_ptr(o)
#define mrb_cptr(o) mrb_ptr(o)
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
#define BOXNAN_SHIFT_LONG_POINTER(v) 0
#endif
#endif
...
@@ -91,7 +85,7 @@ mrb_val_union(mrb_value v)
...
@@ -91,7 +85,7 @@ mrb_val_union(mrb_value v)
o = mrb_value_union_variable.u;\
o = mrb_value_union_variable.u;\
} while (0)
} while (0)
#else
#else
#define BOXNAN_SET_OBJ_VALUE(o, tt, v) BOXNAN_SET_VALUE(o, tt,
p,
v)
#define BOXNAN_SET_OBJ_VALUE(o, tt, v) BOXNAN_SET_VALUE(o, tt,
i, (uint32_t)
v)
#endif
#endif
#define SET_FLOAT_VALUE(mrb,r,v) do { \
#define SET_FLOAT_VALUE(mrb,r,v) do { \
...
@@ -110,8 +104,8 @@ mrb_val_union(mrb_value v)
...
@@ -110,8 +104,8 @@ mrb_val_union(mrb_value v)
#define SET_FALSE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_FALSE, i, 1)
#define SET_FALSE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_FALSE, i, 1)
#define SET_TRUE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_TRUE, i, 1)
#define SET_TRUE_VALUE(r) BOXNAN_SET_VALUE(r, MRB_TT_TRUE, i, 1)
#define SET_BOOL_VALUE(r,b) BOXNAN_SET_VALUE(r, b ? MRB_TT_TRUE : MRB_TT_FALSE, i, 1)
#define SET_BOOL_VALUE(r,b) BOXNAN_SET_VALUE(r, b ? MRB_TT_TRUE : MRB_TT_FALSE, i, 1)
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, i, (n))
#define SET_INT_VALUE(r,n) BOXNAN_SET_VALUE(r, MRB_TT_FIXNUM, i, (
uint32_t)(
n))
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL,
sym,
(v))
#define SET_SYM_VALUE(r,v) BOXNAN_SET_VALUE(r, MRB_TT_SYMBOL,
i, (uint32_t)
(v))
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
#define SET_OBJ_VALUE(r,v) BOXNAN_SET_OBJ_VALUE(r, (((struct RObject*)(v))->tt), (v))
#ifdef MRB_64BIT
#ifdef MRB_64BIT
MRB_API
mrb_value
mrb_nan_boxing_cptr_value
(
struct
mrb_state
*
,
void
*
);
MRB_API
mrb_value
mrb_nan_boxing_cptr_value
(
struct
mrb_state
*
,
void
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment