From e9e9684117719204929821028ba9dbb7915ea119 Mon Sep 17 00:00:00 2001 From: kraxel Date: Sun, 28 Mar 2004 11:31:57 +0000 Subject: Initial revision --- misc.h | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 misc.h (limited to 'misc.h') diff --git a/misc.h b/misc.h new file mode 100644 index 0000000..92a66bc --- /dev/null +++ b/misc.h @@ -0,0 +1,9 @@ +/* + * misc useful #defines ... + */ + +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +#define array_size(x) (sizeof(x)/sizeof(x[0])) -- cgit