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

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

Static Public Member Functions

static 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 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 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 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 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 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 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

uint16 ByteOrder::swap ( uint16  value)
staticnoexcept

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

Referenced by swap(), and swapIfBigEndian().

uint32 ByteOrder::swap ( uint32  value)
staticnoexcept

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

uint64 ByteOrder::swap ( uint64  value)
staticnoexcept
uint16 ByteOrder::swapIfBigEndian ( uint16  value)
staticnoexcept

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

Referenced by swap().

uint32 ByteOrder::swapIfBigEndian ( uint32  value)
staticnoexcept

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

uint64 ByteOrder::swapIfBigEndian ( uint64  value)
staticnoexcept

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

int16 ByteOrder::swapIfBigEndian ( int16  value)
staticnoexcept

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

int32 ByteOrder::swapIfBigEndian ( int32  value)
staticnoexcept

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

int64 ByteOrder::swapIfBigEndian ( int64  value)
staticnoexcept

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

float ByteOrder::swapIfBigEndian ( float  value)
staticnoexcept

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

References swap().

double ByteOrder::swapIfBigEndian ( double  value)
staticnoexcept

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

References swap().

uint16 ByteOrder::swapIfLittleEndian ( uint16  value)
staticnoexcept

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

Referenced by swap().

uint32 ByteOrder::swapIfLittleEndian ( uint32  value)
staticnoexcept

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

uint64 ByteOrder::swapIfLittleEndian ( uint64  value)
staticnoexcept

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

int16 ByteOrder::swapIfLittleEndian ( int16  value)
staticnoexcept

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

int32 ByteOrder::swapIfLittleEndian ( int32  value)
staticnoexcept

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

int64 ByteOrder::swapIfLittleEndian ( int64  value)
staticnoexcept

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

float ByteOrder::swapIfLittleEndian ( float  value)
staticnoexcept

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

double ByteOrder::swapIfLittleEndian ( double  value)
staticnoexcept

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

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

Turns 4 bytes into a little-endian integer.

Referenced by swap().

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

Turns 8 bytes into a little-endian integer.

Referenced by swap().

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

Turns 2 bytes into a little-endian integer.

Referenced by swap().

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

Turns 4 bytes into a big-endian integer.

Referenced by swap().

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

Turns 8 bytes into a big-endian integer.

Referenced by swap().

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

Turns 2 bytes into a big-endian integer.

Referenced by swap().

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

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

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

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

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

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

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

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

bool 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: