avutil/attributes: add AV_GCC_VERSION_AT_MOST

Multimedia / FFmpeg - James Almer [gmail.com] - 18 September 2015 10:41 UTC



###

diff --git a/doc/Doxyfile b/doc/Doxyfile
index 8697e6c..1ad9f30 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 ae5fdb7..611ff0a 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 2340a9a..60fc860 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 ebcdd6b..50e8eb3 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 67f1747..3efd578 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 */

36e1665 avutil/attributes: add AV_GCC_VERSION_AT_MOST
doc/Doxyfile | 1 +
libavutil/arm/bswap.h | 4 ++--
libavutil/arm/intreadwrite.h | 4 ++--
libavutil/attributes.h | 2 ++
libavutil/x86/bswap.h | 8 ++++----
5 files changed, 11 insertions(+), 8 deletions(-)

  • Share