summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2021-07-24 17:06:31 +0200
committerNicolas George <george@nsup.org>2021-08-14 09:17:45 +0200
commit1d8e1afc009f2a916f672fc57f4971504bb13fb3 (patch)
tree326eb8c22efdaea805593b131822bdfbaa09a7a6
parent1c5610824a035604b32cb90d371f29e9d7e23607 (diff)
lavu/internal: add FF_FIELD_AT().
-rw-r--r--libavutil/internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 73498dc70d..b032e7540a 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -99,6 +99,11 @@
#define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr))
+/**
+ * Access a field in a structure by its offset.
+ */
+#define FF_FIELD_AT(type, off, obj) (*(type *)((char *)&(obj) + (off)))
+
#include "libm.h"
/**