Tighten SWAPINT
This commit is contained in:
parent
cc9f7f669d
commit
2d274dba8b
|
@ -40,7 +40,16 @@ static inline int16_t SWAPSHORT(const int16_t &i)
|
|||
{
|
||||
return SWAPSHORT(static_cast<uint16_t>(i));
|
||||
}
|
||||
#define SWAPINT(x) (((x)<<24) | (((uint)(x)) >> 24) | (((x) &0x0000ff00) << 8) | (((x) & 0x00ff0000) >> 8))
|
||||
|
||||
static inline uint32_t SWAPINT(const uint32_t &x)
|
||||
{
|
||||
return (x << 24) | (x >> 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00);
|
||||
}
|
||||
|
||||
static inline int32_t SWAPINT(const int32_t &i)
|
||||
{
|
||||
return SWAPINT(static_cast<uint32_t>(i));
|
||||
}
|
||||
#ifndef macintosh
|
||||
#define SWAPINT64(x) ((((x) & 0xff00000000000000LL) >> 56) | (((x) & 0x00ff000000000000LL) >> 40) | (((x) & 0x0000ff0000000000LL) >> 24) | (((x) & 0x000000ff00000000LL) >> 8) | (((x) & 0x00000000ff000000LL) << 8) | (((x) & 0x0000000000ff0000LL) << 24) | (((x) & 0x000000000000ff00LL) << 40) | (((x) & 0x00000000000000ffLL) << 56))
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue