1#ifndef INTERNAL_STRUCT_H
2#define INTERNAL_STRUCT_H
50#define RSTRUCT(obj) ((struct RStruct *)(obj))
68#define RSTRUCT_LEN internal_RSTRUCT_LEN
69#define RSTRUCT_SET internal_RSTRUCT_SET
70#define RSTRUCT_GET internal_RSTRUCT_GET
76static inline long RSTRUCT_EMBED_LEN(
VALUE st);
77static inline long RSTRUCT_LEN(
VALUE st);
78static inline int RSTRUCT_LENINT(
VALUE st);
79static inline const VALUE *RSTRUCT_CONST_PTR(
VALUE st);
80static inline void RSTRUCT_SET(
VALUE st,
long k,
VALUE v);
81static inline VALUE RSTRUCT_GET(
VALUE st,
long k);
84RSTRUCT_EMBED_LEN(
VALUE st)
87 ret >>= RSTRUCT_EMBED_LEN_SHIFT;
95 return RSTRUCT_EMBED_LEN(st);
98 return RSTRUCT(st)->as.heap.len;
103RSTRUCT_LENINT(
VALUE st)
108static inline const VALUE *
109RSTRUCT_CONST_PTR(
VALUE st)
111 const struct RStruct *p = RSTRUCT(st);
117 return p->as.heap.ptr;
128RSTRUCT_GET(
VALUE st,
long k)
130 return RSTRUCT_CONST_PTR(st)[k];
134RSTRUCT_FIELDS_OBJ(
VALUE st)
136 const long embed_len = RSTRUCT_EMBED_LEN(st);
140 fields_obj = RSTRUCT_GET(st, embed_len);
143 fields_obj = RSTRUCT(st)->as.heap.fields_obj;
149RSTRUCT_SET_FIELDS_OBJ(
VALUE st,
VALUE fields_obj)
151 const long embed_len = RSTRUCT_EMBED_LEN(st);
154 RSTRUCT_SET(st, embed_len, fields_obj);
157 RB_OBJ_WRITE(st, &RSTRUCT(st)->as.heap.fields_obj, fields_obj);
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
@ RUBY_FL_USHIFT
Number of bits in ruby_fl_type that are not open to users.
@ RUBY_FL_USER8
User-defined flag.
@ RUBY_FL_USER5
User-defined flag.
@ RUBY_FL_USER3
User-defined flag.
@ RUBY_FL_USER7
User-defined flag.
@ RUBY_FL_USER6
User-defined flag.
@ RUBY_FL_USER2
User-defined flag.
@ RUBY_FL_USER4
User-defined flag.
@ RUBY_FL_USER1
User-defined flag.
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
#define RB_OBJ_WRITE(old, slot, young)
Declaration of a "back" pointer.
int len
Length of the buffer.
#define rb_long2int
Just another name of rb_long2int_inline.
Ruby object's base components.
uintptr_t VALUE
Type that represents a Ruby object.