Add offsetof() macro.

(Logical change 1.561)
edge.strict_endians
cantab.net!aia21 2004-09-16 22:43:10 +00:00
parent 07b1e1a361
commit 8dde1ae7ba
1 changed files with 5 additions and 0 deletions

View File

@ -46,6 +46,11 @@
#define max(a,b) ((a) >= (b) ? (a) : (b))
#endif
/*
* Useful macro for determining the offset of a struct member.
*/
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
/*
* Simple bit operation macros. NOTE: These are NOT atomic.
*/