-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evan Phoenix
committed
Apr 13, 2009
1 parent
0252c23
commit 97675a2
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |