annotate libavutil/x86/bswap.h @ 9:ea1ba68cf0ed

update to match api changes + add sscc produced source
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Wed, 05 Jun 2013 14:43:26 +0200
parents
children
rev   line source
nengel@2 1 /*
nengel@2 2 * This file is part of FFmpeg.
nengel@2 3 *
nengel@2 4 * FFmpeg is free software; you can redistribute it and/or
nengel@2 5 * modify it under the terms of the GNU Lesser General Public
nengel@2 6 * License as published by the Free Software Foundation; either
nengel@2 7 * version 2.1 of the License, or (at your option) any later version.
nengel@2 8 *
nengel@2 9 * FFmpeg is distributed in the hope that it will be useful,
nengel@2 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nengel@2 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
nengel@2 12 * Lesser General Public License for more details.
nengel@2 13 *
nengel@2 14 * You should have received a copy of the GNU Lesser General Public
nengel@2 15 * License along with FFmpeg; if not, write to the Free Software
nengel@2 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
nengel@2 17 */
nengel@2 18
nengel@2 19 /**
nengel@2 20 * @file
nengel@2 21 * byte swapping routines
nengel@2 22 */
nengel@2 23
nengel@2 24 #ifndef AVUTIL_X86_BSWAP_H
nengel@2 25 #define AVUTIL_X86_BSWAP_H
nengel@2 26
nengel@2 27 #include <stdint.h>
nengel@2 28 #include "config.h"
nengel@2 29 #include "libavutil/attributes.h"
nengel@2 30
nengel@2 31 #define bswap_16 bswap_16
nengel@2 32 static av_always_inline av_const uint16_t bswap_16(uint16_t x)
nengel@2 33 {
nengel@2 34 __asm__("rorw $8, %0" : "+r"(x));
nengel@2 35 return x;
nengel@2 36 }
nengel@2 37
nengel@2 38 #define bswap_32 bswap_32
nengel@2 39 static av_always_inline av_const uint32_t bswap_32(uint32_t x)
nengel@2 40 {
nengel@2 41 // #if HAVE_BSWAP
nengel@2 42 __asm__("bswap %0" : "+r" (x));
nengel@2 43 // #else
nengel@2 44 // __asm__("rorw $8, %w0 \n\t"
nengel@2 45 // "rorl $16, %0 \n\t"
nengel@2 46 // "rorw $8, %w0"
nengel@2 47 // : "+r"(x));
nengel@2 48 // #endif
nengel@2 49 return x;
nengel@2 50 }
nengel@2 51
nengel@2 52 #if ARCH_X86_64
nengel@2 53 #define bswap_64 bswap_64
nengel@2 54 static inline uint64_t av_const bswap_64(uint64_t x)
nengel@2 55 {
nengel@2 56 __asm__("bswap %0": "=r" (x) : "0" (x));
nengel@2 57 return x;
nengel@2 58 }
nengel@2 59 #endif
nengel@2 60
nengel@2 61 #endif /* AVUTIL_X86_BSWAP_H */