summaryrefslogtreecommitdiffstats
path: root/include/dect/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/dect/utils.h')
-rw-r--r--include/dect/utils.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/dect/utils.h b/include/dect/utils.h
new file mode 100644
index 0000000..06ea591
--- /dev/null
+++ b/include/dect/utils.h
@@ -0,0 +1,8 @@
+#ifndef _LIBDECT_DECT_UTILS_H
+#define _LIBDECT_DECT_UTILS_H
+
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
+#endif /* _LIBDECT_DECT_UTILS_H */