summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2016-01-04 10:30:54 +1100
committerErik de Castro Lopo <erikd@mega-nerd.com>2016-01-04 10:31:35 +1100
commit6cc1cbad2c40a4406fd911445b86b3df2291dd79 (patch)
tree417785984cc58a98db9c79acff0e28284dfd25f2 /include
parent0a0e5363ad015e6d33cf6a9598a6b79686e1f663 (diff)
downloadflac-6cc1cbad2c40a4406fd911445b86b3df2291dd79.tar.gz
libFLAC: Support 64bit brword/bwword
This patch allows FLAC__BYTES_PER_WORD to be set to 8, but is disabled by default. Patch-from: lvqcl <lvqcl.mail@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/share/endswap.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/share/endswap.h b/include/share/endswap.h
index 4fde4c15..b189f3ec 100644
--- a/include/share/endswap.h
+++ b/include/share/endswap.h
@@ -43,11 +43,13 @@ static inline unsigned short __builtin_bswap16(unsigned short a)
#define ENDSWAP_16(x) (__builtin_bswap16 (x))
#define ENDSWAP_32(x) (__builtin_bswap32 (x))
+#define ENDSWAP_64(x) (__builtin_bswap64 (x))
#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
#define ENDSWAP_16(x) (_byteswap_ushort (x))
#define ENDSWAP_32(x) (_byteswap_ulong (x))
+#define ENDSWAP_64(x) (_byteswap_uint64 (x))
#elif defined HAVE_BYTESWAP_H /* Linux */
@@ -55,16 +57,18 @@ static inline unsigned short __builtin_bswap16(unsigned short a)
#define ENDSWAP_16(x) (bswap_16 (x))
#define ENDSWAP_32(x) (bswap_32 (x))
+#define ENDSWAP_64(x) (bswap_64 (x))
#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_64(x) ((ENDSWAP_32(((x) >> 32) & 0xFFFFFFFF)) | (ENDSWAP_32((x) & 0xFFFFFFFF) << 32))
#endif
-/* Host to little-endian byte swapping. */
+/* Host to little-endian byte swapping (for MD5 calculation) */
#if CPU_IS_BIG_ENDIAN
#define H2LE_16(x) ENDSWAP_16 (x)