/*1* This file is part of FFmpeg.2*3* FFmpeg is free software; you can redistribute it and/or4* modify it under the terms of the GNU Lesser General Public5* License as published by the Free Software Foundation; either6* version 2.1 of the License, or (at your option) any later version.7*8* FFmpeg is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11* Lesser General Public License for more details.12*13* You should have received a copy of the GNU Lesser General Public14* License along with FFmpeg; if not, write to the Free Software15* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA16*/1718#ifndef AVUTIL_ARM_BSWAP_H19#define AVUTIL_ARM_BSWAP_H2021#include <stdint.h>22#include "config.h"23#include "libavutil/attributes.h"2425#ifdef __ARMCC_VERSION2627#if HAVE_ARMV628#define av_bswap32 av_bswap3229static av_always_inline av_const uint32_t av_bswap32(uint32_t x)30{31return __rev(x);32}33#endif /* HAVE_ARMV6 */3435#elif HAVE_INLINE_ASM3637#if HAVE_ARMV6_INLINE38#define av_bswap16 av_bswap1639static av_always_inline av_const unsigned av_bswap16(unsigned x)40{41__asm__("rev16 %0, %0" : "+r"(x));42return x;43}44#endif4546#if AV_GCC_VERSION_AT_MOST(4,4)47#define av_bswap32 av_bswap3248static av_always_inline av_const uint32_t av_bswap32(uint32_t x)49{50#if HAVE_ARMV6_INLINE51__asm__("rev %0, %0" : "+r"(x));52#else53uint32_t t;54__asm__ ("eor %1, %0, %0, ror #16 \n\t"55"bic %1, %1, #0xFF0000 \n\t"56"mov %0, %0, ror #8 \n\t"57"eor %0, %0, %1, lsr #8 \n\t"58: "+r"(x), "=&r"(t));59#endif /* HAVE_ARMV6_INLINE */60return x;61}62#endif /* AV_GCC_VERSION_AT_MOST(4,4) */6364#endif /* __ARMCC_VERSION */6566#endif /* AVUTIL_ARM_BSWAP_H */676869