summaryrefslogtreecommitdiff
path: root/include/util/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/util/util.h')
-rw-r--r--include/util/util.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/util/util.h b/include/util/util.h
index a08c7ee..095f02a 100644
--- a/include/util/util.h
+++ b/include/util/util.h
@@ -15,6 +15,9 @@
#include "compat.h"
+#define container_of(ptr, type, member) \
+ ((type *)((char *)ptr - offsetof(type, member)))
+
#if defined(__GNUC__) || defined(__clang__)
#define UI_ADD_OV __builtin_uadd_overflow
#define UL_ADD_OV __builtin_uaddl_overflow