summaryrefslogtreecommitdiff
path: root/mjit_compiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'mjit_compiler.c')
-rw-r--r--mjit_compiler.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mjit_compiler.c b/mjit_compiler.c
index 2b518feffd..5ed3aa5a68 100644
--- a/mjit_compiler.c
+++ b/mjit_compiler.c
@@ -164,6 +164,10 @@ has_cache_for_send(rb_execution_context_t *ec, VALUE self, VALUE cc_addr, VALUE
extern bool rb_splat_or_kwargs_p(const struct rb_callinfo *restrict ci);
+// An offsetof implementation that works for unnamed struct and union.
+// Multiplying 8 for compatibility with libclang's offsetof.
+#define OFFSETOF(ptr, member) RB_SIZE2NUM(((char *)&ptr.member - (char*)&ptr) * 8)
+
#define SIZEOF(type) RB_SIZE2NUM(sizeof(type))
#define SIGNED_TYPE_P(type) RBOOL((type)(-1) < (type)(0))