JUCE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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)
 Swaps the upper and lower bytes of a 16-bit integer.
 
static uint32 swap (uint32 value)
 Reverses the order of the 4 bytes in a 32-bit integer.
 
static uint64 swap (uint64 value)
 Reverses the order of the 8 bytes in a 64-bit integer.
 
static uint16 swapIfBigEndian (uint16 value)
 Swaps the byte order of a 16-bit int if the CPU is big-endian.
 
static uint32 swapIfBigEndian (uint32 value)
 Swaps the byte order of a 32-bit int if the CPU is big-endian.
 
static uint64 swapIfBigEndian (uint64 value)
 Swaps the byte order of a 64-bit int if the CPU is big-endian.
 
static uint16 swapIfLittleEndian (uint16 value)
 Swaps the byte order of a 16-bit int if the CPU is little-endian.
 
static uint32 swapIfLittleEndian (uint32 value)
 Swaps the byte order of a 32-bit int if the CPU is little-endian.
 
static uint64 swapIfLittleEndian (uint64 value)
 Swaps the byte order of a 64-bit int if the CPU is little-endian.
 
static uint32 littleEndianInt (const void *bytes)
 Turns 4 bytes into a little-endian integer.
 
static uint16 littleEndianShort (const void *bytes)
 Turns 2 bytes into a little-endian integer.
 
static uint32 bigEndianInt (const void *bytes)
 Turns 4 bytes into a big-endian integer.
 
static uint16 bigEndianShort (const void *bytes)
 Turns 2 bytes into a big-endian integer.
 
static int littleEndian24Bit (const char *bytes)
 Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).
 
static int bigEndian24Bit (const char *bytes)
 Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).
 
static void littleEndian24BitToChars (int value, char *destBytes)
 Copies a 24-bit number to 3 little-endian bytes.
 
static void bigEndian24BitToChars (int value, char *destBytes)
 Copies a 24-bit number to 3 big-endian bytes.
 
static bool isBigEndian ()
 Returns true if the current CPU is big-endian.
 

Detailed Description

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

Member Function Documentation

uint16 ByteOrder::swap ( uint16  value)
static

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

Referenced by littleEndianInt(), littleEndianShort(), swap(), and swapIfBigEndian().

uint32 ByteOrder::swap ( uint32  value)
static

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

uint64 ByteOrder::swap ( uint64  value)
static

Reverses the order of the 8 bytes in a 64-bit integer.

References swap().

uint16 ByteOrder::swapIfBigEndian ( uint16  value)
static

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

References swap().

uint32 ByteOrder::swapIfBigEndian ( uint32  value)
static

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

References swap().

uint64 ByteOrder::swapIfBigEndian ( uint64  value)
static

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

References swap().

uint16 ByteOrder::swapIfLittleEndian ( uint16  value)
static

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

uint32 ByteOrder::swapIfLittleEndian ( uint32  value)
static

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

uint64 ByteOrder::swapIfLittleEndian ( uint64  value)
static

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

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

Turns 4 bytes into a little-endian integer.

References swap().

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

Turns 2 bytes into a little-endian integer.

References swap().

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

Turns 4 bytes into a big-endian integer.

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

Turns 2 bytes into a big-endian integer.

int ByteOrder::littleEndian24Bit ( const char *  bytes)
static

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

int ByteOrder::bigEndian24Bit ( const char *  bytes)
static

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

void ByteOrder::littleEndian24BitToChars ( int  value,
char *  destBytes 
)
static

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

void ByteOrder::bigEndian24BitToChars ( int  value,
char *  destBytes 
)
static

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

bool ByteOrder::isBigEndian ( )
static

Returns true if the current CPU is big-endian.


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