Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

17 lines (13 sloc) 0.433 kb
#ifndef _SRC_COMMON_H_
#define _SRC_COMMON_H_
#ifndef offset_of
// g++ in strict mode complains loudly about the system offsetof() macro
// because it uses NULL as the base address.
# define offset_of(type, member) \
((intptr_t) ((char *) &(((type *) 8)->member) - 8))
#endif
#ifndef container_of
# define container_of(ptr, type, member) \
((type *) ((char *) (ptr) - offset_of(type, member)))
#endif
#endif // _SRC_COMMON_H_
Jump to Line
Something went wrong with that request. Please try again.