[SCM] libav/experimental: 32/64-bit agnostic x86 bswap

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:17:16 UTC 2013


The following commit has been merged in the experimental branch:
commit 3662d880ed9fdc3aa952f174f620f53d1fc1f789
Author: Måns Rullgård <mans at mansr.com>
Date:   Tue Mar 18 22:28:33 2008 +0000

    32/64-bit agnostic x86 bswap
    
    Originally committed as revision 12496 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavutil/bswap.h b/libavutil/bswap.h
index e78c981..64ac5d2 100644
--- a/libavutil/bswap.h
+++ b/libavutil/bswap.h
@@ -34,16 +34,10 @@
 #include <byteswap.h>
 #else
 
-#ifdef ARCH_X86_64
-#  define LEGACY_REGS "=Q"
-#else
-#  define LEGACY_REGS "=q"
-#endif
-
 static av_always_inline uint16_t bswap_16(uint16_t x)
 {
 #if defined(ARCH_X86)
-    asm("rorw $8, %0" : LEGACY_REGS (x) : "0" (x));
+    asm("rorw $8, %0" : "+r"(x));
 #elif defined(ARCH_SH4)
     asm("swap.b %0,%0" : "=r"(x) : "0"(x));
 #else
@@ -56,15 +50,13 @@ static av_always_inline uint32_t bswap_32(uint32_t x)
 {
 #if defined(ARCH_X86)
 #ifdef HAVE_BSWAP
-    asm("bswap   %0":
-          "=r" (x)    :
+    asm("bswap   %0" : "+r" (x));
 #else
-    asm("xchgb   %b0,%h0\n"
-        "rorl    $16,%0 \n"
-        "xchgb   %b0,%h0":
-        LEGACY_REGS (x)  :
+    asm("rorw    $8,  %w0 \n\t"
+        "rorl    $16, %0  \n\t"
+        "rorw    $8,  %w0"
+        : "+r"(x));
 #endif
-          "0" (x));
 #elif defined(ARCH_SH4)
     asm("swap.b %0,%0\n"
         "swap.w %0,%0\n"

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list