summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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