Changeset - r10065:d212881a03ae
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-09-02 21:11:48
smatz@openttd.org
(svn r14232) -Codechange: use builtin for byte swapping for gcc >= 4.3
1 file changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/core/bitmath_func.hpp
Show inline comments
 
@@ -318,7 +318,12 @@ static FORCEINLINE T ROR(const T x, cons
 
	 */
 
	static FORCEINLINE uint32 BSWAP32(uint32 x)
 
	{
 
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4)  && __GNUC_MINOR__ >= 3))
 
		/* GCC >= 4.3 provides a builtin, resulting in faster code */
 
		return (uint32)__builtin_bswap32((int32)x);
 
#else
 
		return ((x >> 24) & 0xFF) | ((x >> 8) & 0xFF00) | ((x << 8) & 0xFF0000) | ((x << 24) & 0xFF000000);
 
#endif /* defined(__GNUC__) */
 
	}
 

	
 
	/**
0 comments (0 inline, 0 general)