diff options
author | Mans Rullgard <mans@mansr.com> | 2011-01-20 02:04:54 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-01-23 19:32:08 +0100 |
commit | 60c99b55108b964f49b2bb96918d26dd8263a4e7 (patch) | |
tree | a3939ebf8ab4b57b37c7ce2374e7a3ee9025d636 /libavcodec | |
parent | d5ec00ba57d8e20aeddca88281a4441c5d80d9f7 (diff) | |
download | ffmpeg-60c99b55108b964f49b2bb96918d26dd8263a4e7.tar.gz |
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: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 96aad41e8157b7c6b577803054e20a0771857424)
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/dsputil.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index c619b78529..842d72746d 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -661,20 +661,24 @@ static inline void emms(void) # define STRIDE_ALIGN 8 #endif -#define LOCAL_ALIGNED(a, t, v, s, ...) \ - uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)]; \ - t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a) +#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \ + uint8_t la_##v[sizeof(t s o) + (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 -# 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 -# 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 #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 -# 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 /* PSNR */ |