[Bf-blender-cvs] [cba0858] master: Fix for recent optimization commit in endian switch

Sergey Sharybin noreply at git.blender.org
Tue Jul 14 11:37:54 CEST 2015


Commit: cba0858ccd74ba983f92d6b7dfc41c2a2d3bf398
Author: Sergey Sharybin
Date:   Tue Jul 14 11:33:50 2015 +0200
Branches: master
https://developer.blender.org/rBcba0858ccd74ba983f92d6b7dfc41c2a2d3bf398

Fix for recent optimization commit in endian switch

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.

===================================================================

M	source/blender/blenlib/BLI_endian_switch_inline.h

===================================================================

diff --git a/source/blender/blenlib/BLI_endian_switch_inline.h b/source/blender/blenlib/BLI_endian_switch_inline.h
index 9c4e819..280503e 100644
--- a/source/blender/blenlib/BLI_endian_switch_inline.h
+++ b/source/blender/blenlib/BLI_endian_switch_inline.h
@@ -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;




More information about the Bf-blender-cvs mailing list