LMMS
Loading...
Searching...
No Matches
water::ByteOrder Class Reference

#include <ByteOrder.h>

Static Public Member Functions

static uint16 swap (uint16 value) noexcept
static uint32 swap (uint32 value) noexcept
static uint64 swap (uint64 value) noexcept
static uint16 swapIfBigEndian (uint16 value) noexcept
static uint32 swapIfBigEndian (uint32 value) noexcept
static uint64 swapIfBigEndian (uint64 value) noexcept
static int16 swapIfBigEndian (int16 value) noexcept
static int32 swapIfBigEndian (int32 value) noexcept
static int64 swapIfBigEndian (int64 value) noexcept
static float swapIfBigEndian (float value) noexcept
static double swapIfBigEndian (double value) noexcept
static uint16 swapIfLittleEndian (uint16 value) noexcept
static uint32 swapIfLittleEndian (uint32 value) noexcept
static uint64 swapIfLittleEndian (uint64 value) noexcept
static int16 swapIfLittleEndian (int16 value) noexcept
static int32 swapIfLittleEndian (int32 value) noexcept
static int64 swapIfLittleEndian (int64 value) noexcept
static float swapIfLittleEndian (float value) noexcept
static double swapIfLittleEndian (double value) noexcept
static uint32 littleEndianInt (const void *bytes) noexcept
static uint64 littleEndianInt64 (const void *bytes) noexcept
static uint16 littleEndianShort (const void *bytes) noexcept
static uint32 bigEndianInt (const void *bytes) noexcept
static uint64 bigEndianInt64 (const void *bytes) noexcept
static uint16 bigEndianShort (const void *bytes) noexcept
static int littleEndian24Bit (const void *bytes) noexcept
static int bigEndian24Bit (const void *bytes) noexcept
static void littleEndian24BitToChars (int value, void *destBytes) noexcept
static void bigEndian24BitToChars (int value, void *destBytes) noexcept
static bool isBigEndian () noexcept

Private Member Functions

 ByteOrder () WATER_DELETED_FUNCTION

Detailed Description

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

Constructor & Destructor Documentation

◆ ByteOrder()

water::ByteOrder::ByteOrder ( )
private

Member Function Documentation

◆ bigEndian24Bit()

int water::ByteOrder::bigEndian24Bit ( const void * bytes)
inlinestaticnoexcept

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

◆ bigEndian24BitToChars()

void water::ByteOrder::bigEndian24BitToChars ( int value,
void * destBytes )
inlinestaticnoexcept

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

◆ bigEndianInt()

uint32 water::ByteOrder::bigEndianInt ( const void * bytes)
inlinestaticnoexcept

Turns 4 bytes into a big-endian integer.

◆ bigEndianInt64()

uint64 water::ByteOrder::bigEndianInt64 ( const void * bytes)
inlinestaticnoexcept

Turns 8 bytes into a big-endian integer.

◆ bigEndianShort()

uint16 water::ByteOrder::bigEndianShort ( const void * bytes)
inlinestaticnoexcept

Turns 2 bytes into a big-endian integer.

◆ isBigEndian()

bool water::ByteOrder::isBigEndian ( )
inlinestaticnoexcept

Returns true if the current CPU is big-endian.

◆ littleEndian24Bit()

int water::ByteOrder::littleEndian24Bit ( const void * bytes)
inlinestaticnoexcept

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

◆ littleEndian24BitToChars()

void water::ByteOrder::littleEndian24BitToChars ( int value,
void * destBytes )
inlinestaticnoexcept

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

◆ littleEndianInt()

uint32 water::ByteOrder::littleEndianInt ( const void * bytes)
inlinestaticnoexcept

Turns 4 bytes into a little-endian integer.

◆ littleEndianInt64()

uint64 water::ByteOrder::littleEndianInt64 ( const void * bytes)
inlinestaticnoexcept

Turns 8 bytes into a little-endian integer.

◆ littleEndianShort()

uint16 water::ByteOrder::littleEndianShort ( const void * bytes)
inlinestaticnoexcept

Turns 2 bytes into a little-endian integer.

◆ swap() [1/3]

uint16 water::ByteOrder::swap ( uint16 value)
inlinestaticnoexcept

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

◆ swap() [2/3]

uint32 water::ByteOrder::swap ( uint32 value)
inlinestaticnoexcept

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

◆ swap() [3/3]

uint64 water::ByteOrder::swap ( uint64 value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [1/8]

double water::ByteOrder::swapIfBigEndian ( double value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [2/8]

float water::ByteOrder::swapIfBigEndian ( float value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [3/8]

int16 water::ByteOrder::swapIfBigEndian ( int16 value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [4/8]

int32 water::ByteOrder::swapIfBigEndian ( int32 value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [5/8]

int64 water::ByteOrder::swapIfBigEndian ( int64 value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [6/8]

uint16 water::ByteOrder::swapIfBigEndian ( uint16 value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [7/8]

uint32 water::ByteOrder::swapIfBigEndian ( uint32 value)
inlinestaticnoexcept

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

◆ swapIfBigEndian() [8/8]

uint64 water::ByteOrder::swapIfBigEndian ( uint64 value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [1/8]

double water::ByteOrder::swapIfLittleEndian ( double value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [2/8]

float water::ByteOrder::swapIfLittleEndian ( float value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [3/8]

int16 water::ByteOrder::swapIfLittleEndian ( int16 value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [4/8]

int32 water::ByteOrder::swapIfLittleEndian ( int32 value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [5/8]

int64 water::ByteOrder::swapIfLittleEndian ( int64 value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [6/8]

uint16 water::ByteOrder::swapIfLittleEndian ( uint16 value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [7/8]

uint32 water::ByteOrder::swapIfLittleEndian ( uint32 value)
inlinestaticnoexcept

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

◆ swapIfLittleEndian() [8/8]

uint64 water::ByteOrder::swapIfLittleEndian ( uint64 value)
inlinestaticnoexcept

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


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