From 4c436b106d1a2b57e28fcaff0d5ec4a7abc6badc Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 20 May 2013 01:32:02 -0700 Subject: Use some macros to help with deriving types --- OpenAL32/Include/alMain.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index d234ae13..a1a90b2f 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -62,6 +62,10 @@ static const union { #define COUNTOF(x) (sizeof((x))/sizeof((x)[0])) +#define DERIVE_FROM_TYPE(t) t t##_parent +#define GET_DERIVED_TYPE(t, o) (&(o)->t##_parent) +#define GET_PARENT_TYPE(t1, t2, o) ((t1*)((char*)(o) - offsetof(t1, t2##_parent))) + #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN -- cgit v1.2.3