avutil/attributes: add AV_GCC_VERSION_AT_MOST

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
pull/151/head
James Almer 9 years ago
parent 2f9ab15960
commit 36e1665d3d
  1. 1
      doc/Doxyfile
  2. 4
      libavutil/arm/bswap.h
  3. 4
      libavutil/arm/intreadwrite.h
  4. 2
      libavutil/attributes.h
  5. 8
      libavutil/x86/bswap.h

@ -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 */

Loading…
Cancel
Save