Commit 96aad41e authored by Mans Rullgard's avatar Mans Rullgard

Make LOCAL_ALIGNED macro fully C99 compatible

C99 variadic macros require more arguments than there are named
parameters in the definition.  This means we must use an extra
indirection to avoid having two different macros for arrays with
one resp more than one dimension.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent ff3d4310
...@@ -661,20 +661,24 @@ static inline void emms(void) ...@@ -661,20 +661,24 @@ static inline void emms(void)
# define STRIDE_ALIGN 8 # define STRIDE_ALIGN 8
#endif #endif
#define LOCAL_ALIGNED(a, t, v, s, ...) \ #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)]; \ uint8_t la_##v[sizeof(t s o) + (a)]; \
t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a) t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)
#if HAVE_LOCAL_ALIGNED_8 #if HAVE_LOCAL_ALIGNED_8
# define LOCAL_ALIGNED_8(t, v, s, ...) DECLARE_ALIGNED(8, t, v) s __VA_ARGS__ # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
#else #else
# define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__) # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
#endif #endif
#if HAVE_LOCAL_ALIGNED_16 #if HAVE_LOCAL_ALIGNED_16
# define LOCAL_ALIGNED_16(t, v, s, ...) DECLARE_ALIGNED(16, t, v) s __VA_ARGS__ # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)
#else #else
# define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__) # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
#endif #endif
/* PSNR */ /* PSNR */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment