Fix for recent optimization commit in endian switch
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 14 Jul 2015 09:33:50 +0000 (11:33 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 14 Jul 2015 09:33:50 +0000 (11:33 +0200)
Pre-4.8 GCC had a bug which lead to non-exposed __builtin_bswap16() symbol.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 for details.

source/blender/blenlib/BLI_endian_switch_inline.h

index 9c4e819399a92d02a7c665debcbd48e33a6f8978..280503e9b93ab2729bb1b27e0ed598a8b5feef23 100644 (file)
@@ -42,7 +42,7 @@ BLI_INLINE void BLI_endian_switch_int16(short *val)
 }
 BLI_INLINE void BLI_endian_switch_uint16(unsigned short *val)
 {
-#ifdef __GNUC__
+#if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 408))  /* gcc4.8+ only */
        *val = __builtin_bswap16(*val);
 #else
        unsigned short tval = *val;