nengel@2: /* nengel@2: * This file is part of FFmpeg. nengel@2: * nengel@2: * FFmpeg is free software; you can redistribute it and/or nengel@2: * modify it under the terms of the GNU Lesser General Public nengel@2: * License as published by the Free Software Foundation; either nengel@2: * version 2.1 of the License, or (at your option) any later version. nengel@2: * nengel@2: * FFmpeg is distributed in the hope that it will be useful, nengel@2: * but WITHOUT ANY WARRANTY; without even the implied warranty of nengel@2: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU nengel@2: * Lesser General Public License for more details. nengel@2: * nengel@2: * You should have received a copy of the GNU Lesser General Public nengel@2: * License along with FFmpeg; if not, write to the Free Software nengel@2: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA nengel@2: */ nengel@2: nengel@2: /** nengel@2: * @file nengel@2: * byte swapping routines nengel@2: */ nengel@2: nengel@2: #ifndef AVUTIL_X86_BSWAP_H nengel@2: #define AVUTIL_X86_BSWAP_H nengel@2: nengel@2: #include nengel@2: #include "config.h" nengel@2: #include "libavutil/attributes.h" nengel@2: nengel@2: #define bswap_16 bswap_16 nengel@2: static av_always_inline av_const uint16_t bswap_16(uint16_t x) nengel@2: { nengel@2: __asm__("rorw $8, %0" : "+r"(x)); nengel@2: return x; nengel@2: } nengel@2: nengel@2: #define bswap_32 bswap_32 nengel@2: static av_always_inline av_const uint32_t bswap_32(uint32_t x) nengel@2: { nengel@2: // #if HAVE_BSWAP nengel@2: __asm__("bswap %0" : "+r" (x)); nengel@2: // #else nengel@2: // __asm__("rorw $8, %w0 \n\t" nengel@2: // "rorl $16, %0 \n\t" nengel@2: // "rorw $8, %w0" nengel@2: // : "+r"(x)); nengel@2: // #endif nengel@2: return x; nengel@2: } nengel@2: nengel@2: #if ARCH_X86_64 nengel@2: #define bswap_64 bswap_64 nengel@2: static inline uint64_t av_const bswap_64(uint64_t x) nengel@2: { nengel@2: __asm__("bswap %0": "=r" (x) : "0" (x)); nengel@2: return x; nengel@2: } nengel@2: #endif nengel@2: nengel@2: #endif /* AVUTIL_X86_BSWAP_H */