<stddef.h> - alternative definition of offsetof for gcc using builtin
This commit is contained in:
parent
50ca7f7f8f
commit
1d0e0e217d
1 changed files with 4 additions and 0 deletions
|
@ -6,7 +6,11 @@
|
||||||
#include <sys/null.h>
|
#include <sys/null.h>
|
||||||
|
|
||||||
/* The following is not portable, but the compiler accepts it. */
|
/* The following is not portable, but the compiler accepts it. */
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define offsetof(type, ident) __builtin_offsetof (type, ident)
|
||||||
|
#else
|
||||||
#define offsetof(type, ident) ((size_t) (unsigned long) &((type *)0)->ident)
|
#define offsetof(type, ident) ((size_t) (unsigned long) &((type *)0)->ident)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if _EM_PSIZE == _EM_WSIZE
|
#if _EM_PSIZE == _EM_WSIZE
|
||||||
typedef int ptrdiff_t; /* result of subtracting two pointers */
|
typedef int ptrdiff_t; /* result of subtracting two pointers */
|
||||||
|
|
Loading…
Reference in a new issue