Commit 36e1665d authored by James Almer's avatar James Almer

avutil/attributes: add AV_GCC_VERSION_AT_MOST

Reviewed-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 2f9ab159
......@@ -1360,6 +1360,7 @@ PREDEFINED = "__attribute__(x)=" \
"offsetof(x,y)=0x42" \
av_alloc_size \
AV_GCC_VERSION_AT_LEAST(x,y)=1 \
AV_GCC_VERSION_AT_MOST(x,y)=0 \
__GNUC__=1 \
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
......
......@@ -44,7 +44,7 @@ static av_always_inline av_const unsigned av_bswap16(unsigned x)
}
#endif
#if !AV_GCC_VERSION_AT_LEAST(4,5)
#if AV_GCC_VERSION_AT_MOST(4,4)
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
......@@ -60,7 +60,7 @@ static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
#endif /* HAVE_ARMV6_INLINE */
return x;
}
#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */
#endif /* AV_GCC_VERSION_AT_MOST(4,4) */
#endif /* __ARMCC_VERSION */
......
......@@ -23,14 +23,14 @@
#include "config.h"
#include "libavutil/attributes.h"
#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM && !AV_GCC_VERSION_AT_LEAST(4,7)
#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM && AV_GCC_VERSION_AT_MOST(4,6)
#define AV_RN16 AV_RN16
static av_always_inline unsigned AV_RN16(const void *p)
{
const uint8_t *q = p;
unsigned v;
#if !AV_GCC_VERSION_AT_LEAST(4,6)
#if AV_GCC_VERSION_AT_MOST(4,5)
__asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)q));
#elif defined __thumb__
__asm__ ("ldrh %0, %1" : "=r"(v) : "m"(q[0]), "m"(q[1]));
......
......@@ -28,8 +28,10 @@
#ifdef __GNUC__
# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y))
# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y))
#else
# define AV_GCC_VERSION_AT_LEAST(x,y) 0
# define AV_GCC_VERSION_AT_MOST(x,y) 0
#endif
#ifndef av_always_inline
......
......@@ -30,16 +30,16 @@
#if HAVE_INLINE_ASM
#if !AV_GCC_VERSION_AT_LEAST(4,1)
#if AV_GCC_VERSION_AT_MOST(4,0)
#define av_bswap16 av_bswap16
static av_always_inline av_const unsigned av_bswap16(unsigned x)
{
__asm__("rorw $8, %w0" : "+r"(x));
return x;
}
#endif /* !AV_GCC_VERSION_AT_LEAST(4,1) */
#endif /* AV_GCC_VERSION_AT_MOST(4,0) */
#if !AV_GCC_VERSION_AT_LEAST(4,5) || defined(__INTEL_COMPILER)
#if AV_GCC_VERSION_AT_MOST(4,4) || defined(__INTEL_COMPILER)
#define av_bswap32 av_bswap32
static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
......@@ -55,7 +55,7 @@ static inline uint64_t av_const av_bswap64(uint64_t x)
return x;
}
#endif
#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */
#endif /* AV_GCC_VERSION_AT_MOST(4,4) */
#endif /* HAVE_INLINE_ASM */
#endif /* AVUTIL_X86_BSWAP_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment