avutil/attributes: add AV_GCC_VERSION_AT_MOST
authorJames Almer <jamrial@gmail.com>
Fri, 18 Sep 2015 04:00:43 +0000 (01:00 -0300)
committerJames Almer <jamrial@gmail.com>
Fri, 18 Sep 2015 15:41:29 +0000 (12:41 -0300)
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
doc/Doxyfile
libavutil/arm/bswap.h
libavutil/arm/intreadwrite.h
libavutil/attributes.h
libavutil/x86/bswap.h

index 8697e6c..1ad9f30 100644 (file)
@@ -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
index ae5fdb7..611ff0a 100644 (file)
@@ -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 */
 
index 2340a9a..60fc860 100644 (file)
 #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]));
index ebcdd6b..50e8eb3 100644 (file)
 
 #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
index 67f1747..3efd578 100644 (file)
 
 #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 */