47 static uint32 swap (uint32 value)
noexcept;
50 static int32 swap (int32 value)
noexcept;
53 static uint64 swap (uint64 value)
noexcept;
56 static int64 swap (int64 value)
noexcept;
59 static float swap (
float value)
noexcept;
62 static double swap (
double value)
noexcept;
66 template <
typename Type>
69 #if JUCE_LITTLE_ENDIAN
77 template <
typename Type>
80 #if JUCE_LITTLE_ENDIAN
101 static void littleEndian24BitToChars (int32 value,
void*
destBytes)
noexcept;
117 static void bigEndian24BitToChars (int32 value,
void*
destBytes)
noexcept;
134 #if JUCE_LITTLE_ENDIAN
149inline int32
ByteOrder::swap (int32
v)
noexcept {
return static_cast<int32
> (swap (
static_cast<uint32
> (
v))); }
150inline int64
ByteOrder::swap (int64
v)
noexcept {
return static_cast<int64
> (swap (
static_cast<uint64
> (
v))); }
154#if JUCE_MSVC && ! defined (__INTEL_COMPILER)
155 #pragma intrinsic (_byteswap_ulong)
160 #if JUCE_MAC || JUCE_IOS
162 #elif (JUCE_GCC || JUCE_CLANG) && JUCE_INTEL && ! JUCE_NO_INLINE_ASM
163 asm(
"bswap %%eax" :
"=a"(
n) :
"a"(
n));
170 return (
n << 24) | (
n >> 24) | ((
n & 0xff00) << 8) | ((
n & 0xff0000) >> 8);
176 #if JUCE_MAC || JUCE_IOS
181 return (((uint64) swap ((uint32) value)) << 32) | swap ((uint32) (value >> 32));
187 return static_cast<uint16
> (
static_cast<uint16
> (
b0) | (
static_cast<uint16
> (
b1) << 8));
192 return static_cast<uint32
> (
b0) | (
static_cast<uint32
> (
b1) << 8)
193 | (
static_cast<uint32
> (
b2) << 16) | (
static_cast<uint32
> (
b3) << 24);
198 return static_cast<uint64
> (
b0) | (
static_cast<uint64
> (
b1) << 8) | (
static_cast<uint64
> (
b2) << 16) | (
static_cast<uint64
> (
b3) << 24)
199 | (
static_cast<uint64
> (
b4) << 32) | (
static_cast<uint64
> (
b5) << 40) | (
static_cast<uint64
> (
b6) << 48) | (
static_cast<uint64
> (
b7) << 56);
204 static_cast<const uint8*
> (
bytes)[2],
static_cast<const uint8*
> (
bytes)[3]); }
206 static_cast<const uint8*
> (
bytes)[2],
static_cast<const uint8*
> (
bytes)[3],
207 static_cast<const uint8*
> (
bytes)[4],
static_cast<const uint8*
> (
bytes)[5],
208 static_cast<const uint8*
> (
bytes)[6],
static_cast<const uint8*
> (
bytes)[7]); }
212 static_cast<const uint8*
> (
bytes)[1],
static_cast<const uint8*
> (
bytes)[0]); }
214 static_cast<const uint8*
> (
bytes)[5],
static_cast<const uint8*
> (
bytes)[4],
215 static_cast<const uint8*
> (
bytes)[3],
static_cast<const uint8*
> (
bytes)[2],
216 static_cast<const uint8*
> (
bytes)[1],
static_cast<const uint8*
> (
bytes)[0]); }
Holds a resizable array of primitive or copy-by-value objects.
Contains static methods for converting the byte order between different endiannesses.
static JUCE_CONSTEXPR uint16 littleEndianShort(const void *bytes) noexcept
Turns 2 bytes into a little-endian integer.
static JUCE_CONSTEXPR uint16 bigEndianShort(const void *bytes) noexcept
Turns 2 bytes into a big-endian integer.
static JUCE_CONSTEXPR uint16 swap(uint16 value) noexcept
Swaps the upper and lower bytes of a 16-bit integer.
static JUCE_CONSTEXPR uint64 littleEndianInt64(const void *bytes) noexcept
Turns 8 bytes into a little-endian integer.
static JUCE_CONSTEXPR uint32 bigEndianInt(const void *bytes) noexcept
Turns 4 bytes into a big-endian integer.
static JUCE_CONSTEXPR bool isBigEndian() noexcept
Returns true if the current CPU is big-endian.
static Type swapIfLittleEndian(Type value) noexcept
Swaps the byte order of a signed or unsigned integer if the CPU is little-endian.
static void littleEndian24BitToChars(int32 value, void *destBytes) noexcept
Copies a 24-bit number to 3 little-endian bytes.
static JUCE_CONSTEXPR uint16 makeInt(uint8 leastSig, uint8 mostSig) noexcept
Constructs a 16-bit integer from its constituent bytes, in order of significance.
static JUCE_CONSTEXPR int bigEndian24Bit(const void *bytes) noexcept
Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).
static void bigEndian24BitToChars(int32 value, void *destBytes) noexcept
Copies a 24-bit number to 3 big-endian bytes.
static Type swapIfBigEndian(Type value) noexcept
Swaps the byte order of a signed or unsigned integer if the CPU is big-endian.
static JUCE_CONSTEXPR uint64 bigEndianInt64(const void *bytes) noexcept
Turns 8 bytes into a big-endian integer.
static JUCE_CONSTEXPR uint32 littleEndianInt(const void *bytes) noexcept
Turns 4 bytes into a little-endian integer.
static JUCE_CONSTEXPR int littleEndian24Bit(const void *bytes) noexcept
Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).
#define JUCE_API
This macro is added to all JUCE public class declarations.