[FFmpeg-devel] [PATCH] avutil: simplify LOCAL_ALIGNED macros

James Almer jamrial at gmail.com
Wed Jul 20 17:25:15 EEST 2016


Signed-off-by: James Almer <jamrial at gmail.com>
---
I went overzealous with cosmetics and added a space before a bracket,
obviously screwing up the macro in the process.

 configure            | 10 ++++------
 libavutil/internal.h | 22 ++++++----------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/configure b/configure
index cc51e67..5b13cbb 100755
--- a/configure
+++ b/configure
@@ -1773,9 +1773,7 @@ ARCH_FEATURES="
     fast_64bit
     fast_clz
     fast_cmov
-    local_aligned_8
-    local_aligned_16
-    local_aligned_32
+    local_aligned
     simd_align_16
 "
 
@@ -4350,7 +4348,7 @@ elif enabled mips; then
             loongson*)
                 enable loongson2
                 enable loongson3
-                enable local_aligned_8 local_aligned_16 local_aligned_32
+                enable local_aligned
                 enable simd_align_16
                 enable fast_64bit
                 enable fast_clz
@@ -5256,7 +5254,7 @@ elif enabled parisc; then
 
 elif enabled ppc; then
 
-    enable local_aligned_8 local_aligned_16 local_aligned_32
+    enable local_aligned
 
     check_inline_asm dcbzl     '"dcbzl 0, %0" :: "r"(0)'
     check_inline_asm ibm_asm   '"add 0, 0, 0"'
@@ -5297,7 +5295,7 @@ elif enabled x86; then
     check_builtin rdtsc    intrin.h   "__rdtsc()"
     check_builtin mm_empty mmintrin.h "_mm_empty()"
 
-    enable local_aligned_8 local_aligned_16 local_aligned_32
+    enable local_aligned
 
     # check whether EBP is available on x86
     # As 'i' is stored on the stack, this program will crash
diff --git a/libavutil/internal.h b/libavutil/internal.h
index 61784b5..836db05 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -107,25 +107,15 @@
     DECLARE_ALIGNED(a, t, la_##v) s o;                  \
     t (*v) o = la_##v
 
-#define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
-
-#if HAVE_LOCAL_ALIGNED_8
-#   define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
-#else
-#   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, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
+#if HAVE_LOCAL_ALIGNED
+#   define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_D(a, t, v, __VA_ARGS__,,))
 #else
-#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
+#   define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,))
 #endif
 
-#if HAVE_LOCAL_ALIGNED_32
-#   define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
-#else
-#   define LOCAL_ALIGNED_32(t, v, ...) LOCAL_ALIGNED(32, t, v, __VA_ARGS__)
-#endif
+#define LOCAL_ALIGNED_8(t, v, ...)  LOCAL_ALIGNED(8,  t, v, __VA_ARGS__)
+#define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
+#define LOCAL_ALIGNED_32(t, v, ...) LOCAL_ALIGNED(32, t, v, __VA_ARGS__)
 
 #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
 {\
-- 
2.9.1



More information about the ffmpeg-devel mailing list