43#if (defined(__linux) || defined(__APPLE__)) && \
44 (defined(__i386__) || defined(__x86_64__)) && \
49#if defined(_WIN32) && (_MSC_VER >= 1300)
51# pragma intrinsic(_byteswap_ushort,_byteswap_ulong,_byteswap_uint64)
57#define R__bswap_constant_16(x) \
58 ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
60#if defined(R__USEASMSWAP)
62# define R__bswap_16(x) __builtin_bswap16(x)
63# elif defined(_MSC_VER)
64# define R__bswap_16(x) _byteswap_ushort(x)
67# define R__bswap_16(x) R__bswap_constant_16(x)
71#define R__bswap_constant_32(x) \
72 ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
73 (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
75#if defined(R__USEASMSWAP)
77# define R__bswap_32(x) __builtin_bswap32(x)
78# elif defined(_MSC_VER)
79# define R__bswap_32(x) _byteswap_ulong(x)
82# define R__bswap_32(x) R__bswap_constant_32(x)
87 x = ((
x & 0x00000000ffffffff) << 32) | ((
x & 0xffffffff00000000) >> 32);
88 x = ((
x & 0x0000ffff0000ffff) << 16) | ((
x & 0xffff0000ffff0000) >> 16);
89 x = ((
x & 0x00ff00ff00ff00ff) << 8) | ((
x & 0xff00ff00ff00ff00) >> 8);
93#if defined(R__USEASMSWAP)
95# define R__bswap_64(x) __builtin_bswap64(x)
96# elif defined(_MSC_VER)
97# define R__bswap_64(x) _byteswap_uint64(x)
100# define R__bswap_64(x) R__bswap_constant_64(x)
105#define Rbswap_16(x) R__bswap_16(x)
108#define Rbswap_32(x) R__bswap_32(x)
111#define Rbswap_64(x) R__bswap_64(x)
static uint64_t R__bswap_constant_64(uint64_t x)
static value_type bswap(value_type x)
static value_type bswap(value_type x)
static value_type bswap(value_type x)
Helper templated class for swapping bytes; specializations for N={2,4,8} are provided below.