lavu/internal: add FF_FIELD_AT().

This commit is contained in:
Nicolas George 2021-07-24 17:06:31 +02:00
parent 1c5610824a
commit 1d8e1afc00
1 changed files with 5 additions and 0 deletions

View File

@ -99,6 +99,11 @@
#define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr)) #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" #include "libm.h"
/** /**