summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2014-08-09 12:47:20 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2014-08-09 12:49:38 +1000
commit7c66452886e3b0bdbff1818f79dd042e9421aaf1 (patch)
treed743666a4ad48b8361f5752b76a5f1649808f7f9 /include
parente9d805dd4374cead02a4e991515bae3bf9547e43 (diff)
downloadflac-7c66452886e3b0bdbff1818f79dd042e9421aaf1.tar.gz
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>
Diffstat (limited to 'include')
-rw-r--r--include/share/endswap.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/share/endswap.h b/include/share/endswap.h
index c3133335..86bf8572 100644
--- a/include/share/endswap.h
+++ b/include/share/endswap.h
@@ -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