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
a5567fba
Unverified
Commit
a5567fba
authored
Nov 08, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
boxing_nan.h: update `mrb_immediate_p` and related macros.
parent
5dc91029
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
include/mruby/boxing_nan.h
include/mruby/boxing_nan.h
+8
-5
No files found.
include/mruby/boxing_nan.h
View file @
a5567fba
...
...
@@ -75,6 +75,8 @@ struct RInteger {
mrb_int
i
;
};
#define mrb_nb_tt(o) ((((o).u>>48)&3))
MRB_INLINE
enum
mrb_vtype
mrb_type
(
mrb_value
o
)
{
...
...
@@ -117,7 +119,7 @@ static inline mrb_int
mrb_nan_boxing_value_int
(
mrb_value
v
)
{
uint64_t
u
=
v
.
u
;
if
(
((
u
>>
48
)
&
3
)
==
MRB_NANBOX_TT_POINTER
)
{
if
(
mrb_nb_tt
(
v
)
==
MRB_NANBOX_TT_POINTER
)
{
struct
RInteger
*
p
=
(
struct
RInteger
*
)(
uintptr_t
)
u
;
return
p
->
i
;
}
...
...
@@ -136,7 +138,7 @@ mrb_nan_boxing_value_int(mrb_value v)
(o).u = ((uint64_t)tt<<48) | ((uint64_t)(v)); \
} while (0)
#define SET_NIL_VALUE(r)
NANBOX_SET_MISC_VALUE(r, MRB_TT_FALSE,
0)
#define SET_NIL_VALUE(r)
((r).u =
0)
#define SET_FALSE_VALUE(r) NANBOX_SET_MISC_VALUE(r, MRB_TT_FALSE, 1)
#define SET_TRUE_VALUE(r) NANBOX_SET_MISC_VALUE(r, MRB_TT_TRUE, 1)
#define SET_BOOL_VALUE(r,b) NANBOX_SET_MISC_VALUE(r, (b) ? MRB_TT_TRUE : MRB_TT_FALSE, 1)
...
...
@@ -152,8 +154,9 @@ MRB_API mrb_value mrb_boxing_int_value(struct mrb_state*, mrb_int);
#define SET_CPTR_VALUE(mrb,r,v) do {(r).u = ((uint64_t)(uintptr_t)v) | 1;} while (0)
#define SET_UNDEF_VALUE(r) NANBOX_SET_MISC_VALUE(r, MRB_TT_UNDEF, 4)
#define mrb_nil_p(o) (mrb_type(o) == MRB_TT_FALSE && ((o).u & 3) == 0)
#define mrb_false_p(o) (mrb_type(o) == MRB_TT_FALSE && ((o).u & 2) == 0)
#define mrb_fixnum_p(o) (!mrb_float_p(o) && ((o.u>>48)&3)==MRB_NANBOX_TT_INTEGER)
#define mrb_immediate_p(o) ((mrb_float_p(o) || mrb_nb_tt(o) != MRB_NANBOX_TT_POINTER) || (o).u == 0)
#define mrb_nil_p(o) ((o).u == 0)
#define mrb_false_p(o) (mrb_type(o) == MRB_TT_FALSE || (o).u == 0)
#define mrb_fixnum_p(o) (!mrb_float_p(o) && mrb_nb_tt(o)==MRB_NANBOX_TT_INTEGER)
#endif
/* MRUBY_BOXING_NAN_H */
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