aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2015-09-18 01:00:43 -0300
committerJames Almer <jamrial@gmail.com>2015-09-18 12:41:29 -0300
commit36e1665d3d068f085d17d72aaf40d4373c8bc217 (patch)
treede1b736d4e5c5731fa731a69ab57597799f35ab1
parent2f9ab159607fd088f8ced1e603da14d203fbfffe (diff)
downloadffmpeg-36e1665d3d068f085d17d72aaf40d4373c8bc217.tar.gz
avutil/attributes: add AV_GCC_VERSION_AT_MOST
Reviewed-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--doc/Doxyfile1
-rw-r--r--libavutil/arm/bswap.h4
-rw-r--r--libavutil/arm/intreadwrite.h4
-rw-r--r--libavutil/attributes.h2
-rw-r--r--libavutil/x86/bswap.h8
5 files changed, 11 insertions, 8 deletions
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 8697e6c551..1ad9f3041f 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -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
diff --git a/libavutil/arm/bswap.h b/libavutil/arm/bswap.h
index ae5fdb7eb8..611ff0ad5b 100644
--- a/libavutil/arm/bswap.h
+++ b/libavutil/arm/bswap.h
@@ -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 */
diff --git a/libavutil/arm/intreadwrite.h b/libavutil/arm/intreadwrite.h
index 2340a9a935..60fc860cbb 100644
--- a/libavutil/arm/intreadwrite.h
+++ b/libavutil/arm/intreadwrite.h
@@ -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]));
diff --git a/libavutil/attributes.h b/libavutil/attributes.h
index ebcdd6b88c..50e8eb37b1 100644
--- a/libavutil/attributes.h
+++ b/libavutil/attributes.h
@@ -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
diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
index 67f1747af6..3efd578b29 100644
--- a/libavutil/x86/bswap.h
+++ b/libavutil/x86/bswap.h
@@ -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 */