43 static uint32 swap (uint32 value)
noexcept;
46 static int32 swap (int32 value)
noexcept;
49 static uint64 swap (uint64 value)
noexcept;
52 static int64 swap (int64 value)
noexcept;
55 static float swap (
float value)
noexcept;
58 static double swap (
double value)
noexcept;
62 template <
typename Type>
65 #if JUCE_LITTLE_ENDIAN
73 template <
typename Type>
76 #if JUCE_LITTLE_ENDIAN
97 static void littleEndian24BitToChars (int32 value,
void*
destBytes)
noexcept;
113 static void bigEndian24BitToChars (int32 value,
void*
destBytes)
noexcept;
130 #if JUCE_LITTLE_ENDIAN
145inline int32
ByteOrder::swap (int32 v)
noexcept {
return static_cast<int32
> (swap (
static_cast<uint32
> (v))); }
146inline int64
ByteOrder::swap (int64 v)
noexcept {
return static_cast<int64
> (swap (
static_cast<uint64
> (v))); }
147inline float ByteOrder::swap (
float v)
noexcept {
union { uint32
asUInt;
float asFloat; } n; n.asFloat = v; n.asUInt = swap (n.asUInt);
return n.asFloat; }
148inline double ByteOrder::swap (
double v)
noexcept {
union { uint64
asUInt;
double asFloat; } n; n.asFloat = v; n.asUInt = swap (n.asUInt);
return n.asFloat; }
150#if JUCE_MSVC && ! defined (__INTEL_COMPILER)
151 #pragma intrinsic (_byteswap_ulong)
156 #if JUCE_MAC || JUCE_IOS
158 #elif (JUCE_GCC || JUCE_CLANG) && JUCE_INTEL && ! JUCE_NO_INLINE_ASM
159 asm(
"bswap %%eax" :
"=a"(n) :
"a"(n));
166 return (n << 24) | (n >> 24) | ((n & 0xff00) << 8) | ((n & 0xff0000) >> 8);
172 #if JUCE_MAC || JUCE_IOS
177 return (((uint64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
183 return static_cast<uint16
> (
static_cast<uint16
> (
b0) | (
static_cast<uint16
> (
b1) << 8));
188 return static_cast<uint32
> (
b0) | (
static_cast<uint32
> (
b1) << 8)
189 | (
static_cast<uint32
> (
b2) << 16) | (
static_cast<uint32
> (
b3) << 24);
194 return static_cast<uint64
> (
b0) | (
static_cast<uint64
> (
b1) << 8) | (
static_cast<uint64
> (
b2) << 16) | (
static_cast<uint64
> (
b3) << 24)
195 | (
static_cast<uint64
> (
b4) << 32) | (
static_cast<uint64
> (
b5) << 40) | (
static_cast<uint64
> (
b6) << 48) | (
static_cast<uint64
> (
b7) << 56);
200 static_cast<const uint8*
> (
bytes)[2],
static_cast<const uint8*
> (
bytes)[3]); }
202 static_cast<const uint8*
> (
bytes)[2],
static_cast<const uint8*
> (
bytes)[3],
203 static_cast<const uint8*
> (
bytes)[4],
static_cast<const uint8*
> (
bytes)[5],
204 static_cast<const uint8*
> (
bytes)[6],
static_cast<const uint8*
> (
bytes)[7]); }
208 static_cast<const uint8*
> (
bytes)[1],
static_cast<const uint8*
> (
bytes)[0]); }
210 static_cast<const uint8*
> (
bytes)[5],
static_cast<const uint8*
> (
bytes)[4],
211 static_cast<const uint8*
> (
bytes)[3],
static_cast<const uint8*
> (
bytes)[2],
212 static_cast<const uint8*
> (
bytes)[1],
static_cast<const uint8*
> (
bytes)[0]); }
static JUCE_CONSTEXPR uint16 littleEndianShort(const void *bytes) noexcept
static JUCE_CONSTEXPR uint16 bigEndianShort(const void *bytes) noexcept
static JUCE_CONSTEXPR uint16 swap(uint16 value) noexcept
static JUCE_CONSTEXPR uint64 littleEndianInt64(const void *bytes) noexcept
static JUCE_CONSTEXPR uint32 bigEndianInt(const void *bytes) noexcept
static JUCE_CONSTEXPR bool isBigEndian() noexcept
static Type swapIfLittleEndian(Type value) noexcept
static void littleEndian24BitToChars(int32 value, void *destBytes) noexcept
static JUCE_CONSTEXPR uint16 makeInt(uint8 leastSig, uint8 mostSig) noexcept
static JUCE_CONSTEXPR int bigEndian24Bit(const void *bytes) noexcept
static void bigEndian24BitToChars(int32 value, void *destBytes) noexcept
static Type swapIfBigEndian(Type value) noexcept
static JUCE_CONSTEXPR uint64 bigEndianInt64(const void *bytes) noexcept
static JUCE_CONSTEXPR uint32 littleEndianInt(const void *bytes) noexcept
static JUCE_CONSTEXPR int littleEndian24Bit(const void *bytes) noexcept