On date Thursday 2011-06-30 14:31:57 +0200, Diego Biurrun encoded:
> On Thu, Jun 30, 2011 at 02:12:46PM +0200, Stefano Sabatini wrote:
> > On date Thursday 2011-06-30 13:37:00 +0200, Diego Biurrun encoded:
[...]
> > > > This is still busted on non-x86.  It needs a complete rewrite.
> > > 
> > > As an alternative, I could remove it - I'll send a patch for that.
> > 
> > Eh? What's the point of removing everything which "looks broken"?, tests are
> > useful both as API usage example and for testing the code (e.g. when
> > debugging).
> 

> I suggest you look at that program first before flaming :)

Check the attached patch.

> That said, FFmpeg history has shown that old broken code never gets
> fixed anyway, it's just left to rot and rot and rot ...

There are notable exceptions, removing old broken/unused code should
be done on a case-by-case basis and only if there is a real need for
it.
>From 1d317a80631d26ea833b9f91939c9a1847b2c816 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <[email protected]>
Date: Thu, 30 Jun 2011 15:01:25 +0200
Subject: [PATCH] cpu: fix cpu-test program, to make it work also on non-x86 machines

---
 libavutil/cpu.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index c439a83..bc929b9 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -49,12 +49,15 @@ int main(void)
     int cpu_flags = av_get_cpu_flags();
 
     printf("cpu_flags = 0x%08X\n", cpu_flags);
-    printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+    printf("cpu_flags = "
 #if   ARCH_ARM
-           cpu_flags & AV_CPU_FLAG_IWMMXT   ? "IWMMXT "     : "",
+           "%s\n",
+           cpu_flags & AV_CPU_FLAG_IWMMXT   ? "IWMMXT "     : ""
 #elif ARCH_PPC
-           cpu_flags & AV_CPU_FLAG_ALTIVEC  ? "ALTIVEC "    : "",
+           "%s\n"
+           cpu_flags & AV_CPU_FLAG_ALTIVEC  ? "ALTIVEC "    : ""
 #elif ARCH_X86
+           "%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
            cpu_flags & AV_CPU_FLAG_MMX      ? "MMX "        : "",
            cpu_flags & AV_CPU_FLAG_MMX2     ? "MMX2 "       : "",
            cpu_flags & AV_CPU_FLAG_SSE      ? "SSE "        : "",
@@ -68,8 +71,9 @@ int main(void)
            cpu_flags & AV_CPU_FLAG_SSE42    ? "SSE4.2 "     : "",
            cpu_flags & AV_CPU_FLAG_AVX      ? "AVX "        : "",
            cpu_flags & AV_CPU_FLAG_3DNOW    ? "3DNow "      : "",
-           cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt "   : "");
+           cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt "   : ""
 #endif
+    );
     return 0;
 }
 
-- 
1.7.2.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to