summaryrefslogtreecommitdiff
path: root/src/main/c/common/offset_of.h
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2024-05-12 12:55:07 +0200
committerAndreas Fankhauser hiddenalpha.ch2024-05-12 12:55:07 +0200
commit5cc4c2b95df9bf6998d92496ca0e0064314fba39 (patch)
treeac7d979f81a86703508ff23e2694a6b4d6bfe4d5 /src/main/c/common/offset_of.h
parent1dc9f8c9db499a326ceee6cb3b48878ee17ff9fa (diff)
parent95d934e8e3918832c03f05b2fc32cb5d5272cb83 (diff)
downloadUnspecifiedGarbage-wip-LatitudeReSetup-20230620.zip
UnspecifiedGarbage-wip-LatitudeReSetup-20230620.tar.gz
Merge remote-tracking branch 'ha-public/master' into wip-LatitudeReSetup-20230620wip-LatitudeReSetup-20230620
Diffstat (limited to 'src/main/c/common/offset_of.h')
-rw-r--r--src/main/c/common/offset_of.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/c/common/offset_of.h b/src/main/c/common/offset_of.h
new file mode 100644
index 0000000..7d9179d
--- /dev/null
+++ b/src/main/c/common/offset_of.h
@@ -0,0 +1,9 @@
+#ifndef INCGUARD_yisgKqALPG4lfEqb
+#define INCGUARD_yisgKqALPG4lfEqb
+
+
+#define container_of(P, T, M) \
+ ((T*)( ((size_t)P) - ((size_t)((char*)&((T*)0)->M - (char*)0) )))
+
+
+#endif /* INCGUARD_yisgKqALPG4lfEqb */