mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 02:17:27 +08:00
librhash: Implement bswap_64 even in strict C90 mode
This commit is contained in:
@@ -120,8 +120,8 @@ static inline uint32_t bswap_32(uint32_t x) {
|
|||||||
# define bswap_64(x) __builtin_bswap64(x)
|
# define bswap_64(x) __builtin_bswap64(x)
|
||||||
#elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64)) /* MS VC */
|
#elif (_MSC_VER > 1300) && (defined(CPU_IA32) || defined(CPU_X64)) /* MS VC */
|
||||||
# define bswap_64(x) _byteswap_uint64((__int64)x)
|
# define bswap_64(x) _byteswap_uint64((__int64)x)
|
||||||
#elif !defined(__STRICT_ANSI__)
|
#else
|
||||||
static inline uint64_t bswap_64(uint64_t x) {
|
static uint64_t bswap_64(uint64_t x) {
|
||||||
union {
|
union {
|
||||||
uint64_t ll;
|
uint64_t ll;
|
||||||
uint32_t l[2];
|
uint32_t l[2];
|
||||||
@@ -131,8 +131,6 @@ static inline uint64_t bswap_64(uint64_t x) {
|
|||||||
r.l[1] = bswap_32(w.l[0]);
|
r.l[1] = bswap_32(w.l[0]);
|
||||||
return r.ll;
|
return r.ll;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#error "bswap_64 unsupported"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CPU_BIG_ENDIAN
|
#ifdef CPU_BIG_ENDIAN
|
||||||
|
Reference in New Issue
Block a user