Commit 7c664528 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

include/share/endswap.h : Improvements to fallthrough ENDSWAP_*.

According to patch author GCC can optimize expressions like
"(a<<8)|(a>>8)", but has problems with "(a<<8)+(a>>8)".

Patch-from: lvqcl <lvqcl.mail@gmail.com>
parent e9d805dd
......@@ -58,8 +58,8 @@ static inline unsigned short __builtin_bswap16(unsigned short a)
#else
#define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) + (((x) & 0xFF) << 8))
#define ENDSWAP_32(x) ((((x) >> 24) & 0xFF) + (((x) >> 8) & 0xFF00) + (((x) & 0xFF00) << 8) + (((x) & 0xFF) << 24))
#define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) | (((x) & 0xFF) << 8))
#define ENDSWAP_32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) & 0xFF00) << 8) | (((x) & 0xFF) << 24))
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment