Skip to content

Instantly share code, notes, and snippets.

@coruus
Created August 30, 2014 19:06
Show Gist options
  • Save coruus/1d7528967bfe763aa27f to your computer and use it in GitHub Desktop.
Save coruus/1d7528967bfe763aa27f to your computer and use it in GitHub Desktop.
What does it mean?
typedef union {
int a;
short b;
char c[1];
long d;
#ifdef HAVE_U64_TYPEDEF
u64 e;
#endif
float f;
double g;
} PROPERLY_ALIGNED_TYPE;
typedef struct memblock_struct MEMBLOCK;
struct memblock_struct {
unsigned size;
union {
MEMBLOCK *next;
PROPERLY_ALIGNED_TYPE aligned;
} u;
};
MEMBLOCK* mb = (MEMBLOCK*)((char*)p - ((size_t) &((MEMBLOCK*)0)->u.aligned.c));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment