Changeset View
Changeset View
Standalone View
Standalone View
src/compat/byteswap.h
Show All 9 Lines | |||||
#endif | #endif | ||||
#include <cstdint> | #include <cstdint> | ||||
#if defined(HAVE_BYTESWAP_H) | #if defined(HAVE_BYTESWAP_H) | ||||
#include <byteswap.h> | #include <byteswap.h> | ||||
#endif | #endif | ||||
#if defined(__APPLE__) | #if defined(MAC_OSX) | ||||
#if !defined(bswap_16) | #if !defined(bswap_16) | ||||
// Mac OS X / Darwin features; we include a check for bswap_16 because if it is | // Mac OS X / Darwin features; we include a check for bswap_16 because if it is | ||||
// already defined, protobuf has defined these macros for us already; if it | // already defined, protobuf has defined these macros for us already; if it | ||||
// isn't, we do it ourselves. In either case, we get the exact same result | // isn't, we do it ourselves. In either case, we get the exact same result | ||||
// regardless which path was taken | // regardless which path was taken | ||||
#include <libkern/OSByteOrder.h> | #include <libkern/OSByteOrder.h> | ||||
Show All 27 Lines | return (((x & 0xff00000000000000ull) >> 56) | | ||||
((x & 0x000000ff00000000ull) >> 8) | | ((x & 0x000000ff00000000ull) >> 8) | | ||||
((x & 0x00000000ff000000ull) << 8) | | ((x & 0x00000000ff000000ull) << 8) | | ||||
((x & 0x0000000000ff0000ull) << 24) | | ((x & 0x0000000000ff0000ull) << 24) | | ||||
((x & 0x000000000000ff00ull) << 40) | | ((x & 0x000000000000ff00ull) << 40) | | ||||
((x & 0x00000000000000ffull) << 56)); | ((x & 0x00000000000000ffull) << 56)); | ||||
} | } | ||||
#endif // HAVE_DECL_BSWAP64 | #endif // HAVE_DECL_BSWAP64 | ||||
#endif // defined(__APPLE__) | #endif // defined(MAC_OSX) | ||||
#endif // BITCOIN_COMPAT_BYTESWAP_H | #endif // BITCOIN_COMPAT_BYTESWAP_H |