JUCE
Static Public Member Functions | List of all members
juce::ByteOrder Class Reference

Contains static methods for converting the byte order between different endiannesses. More...

Static Public Member Functions

static JUCE_CONSTEXPR uint16 swap (uint16 value) noexcept
 Swaps the upper and lower bytes of a 16-bit integer. More...
 
static uint32 swap (uint32 value) noexcept
 Reverses the order of the 4 bytes in a 32-bit integer. More...
 
static uint64 swap (uint64 value) noexcept
 Reverses the order of the 8 bytes in a 64-bit integer. More...
 
static JUCE_CONSTEXPR uint16 swapIfBigEndian (uint16 value) noexcept
 Swaps the byte order of a 16-bit unsigned int if the CPU is big-endian. More...
 
static uint32 swapIfBigEndian (uint32 value) noexcept
 Swaps the byte order of a 32-bit unsigned int if the CPU is big-endian. More...
 
static uint64 swapIfBigEndian (uint64 value) noexcept
 Swaps the byte order of a 64-bit unsigned int if the CPU is big-endian. More...
 
static JUCE_CONSTEXPR int16 swapIfBigEndian (int16 value) noexcept
 Swaps the byte order of a 16-bit signed int if the CPU is big-endian. More...
 
static int32 swapIfBigEndian (int32 value) noexcept
 Swaps the byte order of a 32-bit signed int if the CPU is big-endian. More...
 
static int64 swapIfBigEndian (int64 value) noexcept
 Swaps the byte order of a 64-bit signed int if the CPU is big-endian. More...
 
static float swapIfBigEndian (float value) noexcept
 Swaps the byte order of a 32-bit float if the CPU is big-endian. More...
 
static double swapIfBigEndian (double value) noexcept
 Swaps the byte order of a 64-bit float if the CPU is big-endian. More...
 
static JUCE_CONSTEXPR uint16 swapIfLittleEndian (uint16 value) noexcept
 Swaps the byte order of a 16-bit unsigned int if the CPU is little-endian. More...
 
static uint32 swapIfLittleEndian (uint32 value) noexcept
 Swaps the byte order of a 32-bit unsigned int if the CPU is little-endian. More...
 
static uint64 swapIfLittleEndian (uint64 value) noexcept
 Swaps the byte order of a 64-bit unsigned int if the CPU is little-endian. More...
 
static JUCE_CONSTEXPR int16 swapIfLittleEndian (int16 value) noexcept
 Swaps the byte order of a 16-bit signed int if the CPU is little-endian. More...
 
static int32 swapIfLittleEndian (int32 value) noexcept
 Swaps the byte order of a 32-bit signed int if the CPU is little-endian. More...
 
static int64 swapIfLittleEndian (int64 value) noexcept
 Swaps the byte order of a 64-bit signed int if the CPU is little-endian. More...
 
static float swapIfLittleEndian (float value) noexcept
 Swaps the byte order of a 32-bit float if the CPU is little-endian. More...
 
static double swapIfLittleEndian (double value) noexcept
 Swaps the byte order of a 64-bit float if the CPU is little-endian. More...
 
static uint32 littleEndianInt (const void *bytes) noexcept
 Turns 4 bytes into a little-endian integer. More...
 
static JUCE_CONSTEXPR uint32 littleEndianInt (char c1, char c2, char c3, char c4) noexcept
 Turns 4 characters into a little-endian integer. More...
 
static uint64 littleEndianInt64 (const void *bytes) noexcept
 Turns 8 bytes into a little-endian integer. More...
 
static uint16 littleEndianShort (const void *bytes) noexcept
 Turns 2 bytes into a little-endian integer. More...
 
static uint32 bigEndianInt (const void *bytes) noexcept
 Turns 4 bytes into a big-endian integer. More...
 
static uint64 bigEndianInt64 (const void *bytes) noexcept
 Turns 8 bytes into a big-endian integer. More...
 
static uint16 bigEndianShort (const void *bytes) noexcept
 Turns 2 bytes into a big-endian integer. More...
 
static int littleEndian24Bit (const void *bytes) noexcept
 Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). More...
 
static int bigEndian24Bit (const void *bytes) noexcept
 Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits). More...
 
static void littleEndian24BitToChars (int value, void *destBytes) noexcept
 Copies a 24-bit number to 3 little-endian bytes. More...
 
static void bigEndian24BitToChars (int value, void *destBytes) noexcept
 Copies a 24-bit number to 3 big-endian bytes. More...
 
static JUCE_CONSTEXPR bool isBigEndian () noexcept
 Returns true if the current CPU is big-endian. More...
 

Detailed Description

Contains static methods for converting the byte order between different endiannesses.

Member Function Documentation

◆ swap() [1/3]

JUCE_CONSTEXPR uint16 juce::ByteOrder::swap ( uint16  value)
staticnoexcept

Swaps the upper and lower bytes of a 16-bit integer.

Referenced by swap(), and swapIfBigEndian().

◆ swap() [2/3]

uint32 juce::ByteOrder::swap ( uint32  value)
staticnoexcept

Reverses the order of the 4 bytes in a 32-bit integer.

◆ swap() [3/3]

uint64 juce::ByteOrder::swap ( uint64  value)
staticnoexcept

◆ swapIfBigEndian() [1/8]

JUCE_CONSTEXPR uint16 juce::ByteOrder::swapIfBigEndian ( uint16  value)
staticnoexcept

Swaps the byte order of a 16-bit unsigned int if the CPU is big-endian.

Referenced by swap().

◆ swapIfBigEndian() [2/8]

uint32 juce::ByteOrder::swapIfBigEndian ( uint32  value)
staticnoexcept

Swaps the byte order of a 32-bit unsigned int if the CPU is big-endian.

◆ swapIfBigEndian() [3/8]

uint64 juce::ByteOrder::swapIfBigEndian ( uint64  value)
staticnoexcept

Swaps the byte order of a 64-bit unsigned int if the CPU is big-endian.

◆ swapIfBigEndian() [4/8]

JUCE_CONSTEXPR int16 juce::ByteOrder::swapIfBigEndian ( int16  value)
staticnoexcept

Swaps the byte order of a 16-bit signed int if the CPU is big-endian.

◆ swapIfBigEndian() [5/8]

int32 juce::ByteOrder::swapIfBigEndian ( int32  value)
staticnoexcept

Swaps the byte order of a 32-bit signed int if the CPU is big-endian.

◆ swapIfBigEndian() [6/8]

int64 juce::ByteOrder::swapIfBigEndian ( int64  value)
staticnoexcept

Swaps the byte order of a 64-bit signed int if the CPU is big-endian.

◆ swapIfBigEndian() [7/8]

float juce::ByteOrder::swapIfBigEndian ( float  value)
staticnoexcept

Swaps the byte order of a 32-bit float if the CPU is big-endian.

References swap().

◆ swapIfBigEndian() [8/8]

double juce::ByteOrder::swapIfBigEndian ( double  value)
staticnoexcept

Swaps the byte order of a 64-bit float if the CPU is big-endian.

References swap().

◆ swapIfLittleEndian() [1/8]

JUCE_CONSTEXPR uint16 juce::ByteOrder::swapIfLittleEndian ( uint16  value)
staticnoexcept

Swaps the byte order of a 16-bit unsigned int if the CPU is little-endian.

Referenced by swap().

◆ swapIfLittleEndian() [2/8]

uint32 juce::ByteOrder::swapIfLittleEndian ( uint32  value)
staticnoexcept

Swaps the byte order of a 32-bit unsigned int if the CPU is little-endian.

◆ swapIfLittleEndian() [3/8]

uint64 juce::ByteOrder::swapIfLittleEndian ( uint64  value)
staticnoexcept

Swaps the byte order of a 64-bit unsigned int if the CPU is little-endian.

◆ swapIfLittleEndian() [4/8]

JUCE_CONSTEXPR int16 juce::ByteOrder::swapIfLittleEndian ( int16  value)
staticnoexcept

Swaps the byte order of a 16-bit signed int if the CPU is little-endian.

◆ swapIfLittleEndian() [5/8]

int32 juce::ByteOrder::swapIfLittleEndian ( int32  value)
staticnoexcept

Swaps the byte order of a 32-bit signed int if the CPU is little-endian.

◆ swapIfLittleEndian() [6/8]

int64 juce::ByteOrder::swapIfLittleEndian ( int64  value)
staticnoexcept

Swaps the byte order of a 64-bit signed int if the CPU is little-endian.

◆ swapIfLittleEndian() [7/8]

float juce::ByteOrder::swapIfLittleEndian ( float  value)
staticnoexcept

Swaps the byte order of a 32-bit float if the CPU is little-endian.

◆ swapIfLittleEndian() [8/8]

double juce::ByteOrder::swapIfLittleEndian ( double  value)
staticnoexcept

Swaps the byte order of a 64-bit float if the CPU is little-endian.

◆ littleEndianInt() [1/2]

uint32 juce::ByteOrder::littleEndianInt ( const void *  bytes)
staticnoexcept

Turns 4 bytes into a little-endian integer.

Referenced by swap().

◆ littleEndianInt() [2/2]

JUCE_CONSTEXPR uint32 juce::ByteOrder::littleEndianInt ( char  c1,
char  c2,
char  c3,
char  c4 
)
staticnoexcept

Turns 4 characters into a little-endian integer.

◆ littleEndianInt64()

uint64 juce::ByteOrder::littleEndianInt64 ( const void *  bytes)
staticnoexcept

Turns 8 bytes into a little-endian integer.

Referenced by swap().

◆ littleEndianShort()

uint16 juce::ByteOrder::littleEndianShort ( const void *  bytes)
staticnoexcept

Turns 2 bytes into a little-endian integer.

Referenced by swap().

◆ bigEndianInt()

uint32 juce::ByteOrder::bigEndianInt ( const void *  bytes)
staticnoexcept

Turns 4 bytes into a big-endian integer.

Referenced by swap().

◆ bigEndianInt64()

uint64 juce::ByteOrder::bigEndianInt64 ( const void *  bytes)
staticnoexcept

Turns 8 bytes into a big-endian integer.

Referenced by swap().

◆ bigEndianShort()

uint16 juce::ByteOrder::bigEndianShort ( const void *  bytes)
staticnoexcept

Turns 2 bytes into a big-endian integer.

Referenced by swap().

◆ littleEndian24Bit()

int juce::ByteOrder::littleEndian24Bit ( const void *  bytes)
staticnoexcept

Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).

◆ bigEndian24Bit()

int juce::ByteOrder::bigEndian24Bit ( const void *  bytes)
staticnoexcept

Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).

◆ littleEndian24BitToChars()

void juce::ByteOrder::littleEndian24BitToChars ( int  value,
void *  destBytes 
)
staticnoexcept

Copies a 24-bit number to 3 little-endian bytes.

◆ bigEndian24BitToChars()

void juce::ByteOrder::bigEndian24BitToChars ( int  value,
void *  destBytes 
)
staticnoexcept

Copies a 24-bit number to 3 big-endian bytes.

◆ isBigEndian()

JUCE_CONSTEXPR bool juce::ByteOrder::isBigEndian ( )
staticnoexcept

Returns true if the current CPU is big-endian.

Referenced by swap().


The documentation for this class was generated from the following file: