summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-26 18:53:23 -0400
committermidipix <writeonce@midipix.org>2016-10-26 22:10:22 -0400
commit2c7a1617079024d4844a8872c845c9b109a76025 (patch)
tree8c0d0e4cbff5b36938acadc9c05f90bd0d590e3c /src
parent1d72ca61b015f5d5b7f5509e1d3bc6fcee82e379 (diff)
downloadapimagic-2c7a1617079024d4844a8872c845c9b109a76025.tar.bz2
apimagic-2c7a1617079024d4844a8872c845c9b109a76025.tar.xz
driver: internals: added the static inlined amgc_get_driver_ictx() helper.
Diffstat (limited to 'src')
-rw-r--r--src/internal/apimagic_driver_impl.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/internal/apimagic_driver_impl.h b/src/internal/apimagic_driver_impl.h
index 2e42ce4..6d5ce02 100644
--- a/src/internal/apimagic_driver_impl.h
+++ b/src/internal/apimagic_driver_impl.h
@@ -50,4 +50,18 @@ struct amgc_unit_ctx_impl {
struct compilation_unit_t ccunit;
};
+
+static inline struct amgc_driver_ctx_impl * amgc_get_driver_ictx(
+ const struct amgc_driver_ctx * dctx)
+{
+ uintptr_t addr;
+
+ if (dctx) {
+ addr = (uintptr_t)dctx - offsetof(struct amgc_driver_ctx_impl,ctx);
+ return (struct amgc_driver_ctx_impl *)addr;
+ }
+
+ return 0;
+}
+
#endif