Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add missed file

  • Loading branch information...
commit 97675a296b887ab3bbd29410d5d52aef02b73cb8 1 parent 0252c23
Evan Phoenix authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 vm/field_offset.hpp
View
15 vm/field_offset.hpp
@@ -0,0 +1,15 @@
+#ifndef RBX_FIELD_OFFSET
+#define RBX_FIELD_OFFSET
+
+#include <stdint.h>
+
+// Stolen from Squirrelfish Extreme's JIT.cpp
+// FIELD_OFFSET: Like the C++ offsetof macro, but you can use it with classes.
+// The magic number 0x4000 is insignificant. We use it to avoid using NULL, since
+// NULL can cause compiler problems, especially in cases of multiple inheritance.
+#ifdef FIELD_OFFSET
+#undef FIELD_OFFSET // Fix conflict with winnt.h.
+#endif
+#define FIELD_OFFSET(class, field) (reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<class*>(0x4000)->field)) - 0x4000)
+
+#endif
Please sign in to comment.
Something went wrong with that request. Please try again.