JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::ByteOrder Class Reference

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

#include <juce_ByteOrder.h>

Static Public Member Functions

constexpr 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 bigEndian24BitToChars (int32 value, void *destBytes) noexcept
 Copies a 24-bit number to 3 big-endian bytes. More...
 
constexpr static uint32 bigEndianInt (const void *bytes) noexcept
 Turns 4 bytes into a big-endian integer. More...
 
constexpr static uint64 bigEndianInt64 (const void *bytes) noexcept
 Turns 8 bytes into a big-endian integer. More...
 
constexpr static uint16 bigEndianShort (const void *bytes) noexcept
 Turns 2 bytes into a big-endian integer. More...
 
constexpr static bool isBigEndian () noexcept
 Returns true if the current CPU is big-endian. More...
 
constexpr 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 void littleEndian24BitToChars (int32 value, void *destBytes) noexcept
 Copies a 24-bit number to 3 little-endian bytes. More...
 
constexpr static uint32 littleEndianInt (const void *bytes) noexcept
 Turns 4 bytes into a little-endian integer. More...
 
constexpr static uint64 littleEndianInt64 (const void *bytes) noexcept
 Turns 8 bytes into a little-endian integer. More...
 
constexpr static uint16 littleEndianShort (const void *bytes) noexcept
 Turns 2 bytes into a little-endian integer. More...
 
constexpr static uint64 makeInt (uint8 leastSig, uint8 byte1, uint8 byte2, uint8 byte3, uint8 byte4, uint8 byte5, uint8 byte6, uint8 mostSig) noexcept
 Constructs a 64-bit integer from its constituent bytes, in order of significance. More...
 
constexpr static uint32 makeInt (uint8 leastSig, uint8 byte1, uint8 byte2, uint8 mostSig) noexcept
 Constructs a 32-bit integer from its constituent bytes, in order of significance. More...
 
constexpr static uint16 makeInt (uint8 leastSig, uint8 mostSig) noexcept
 Constructs a 16-bit integer from its constituent bytes, in order of significance. More...
 
static double swap (double value) noexcept
 Returns a garbled double which has the reverse byte-order of the original. More...
 
static float swap (float value) noexcept
 Returns a garbled float which has the reverse byte-order of the original. More...
 
constexpr static int16 swap (int16 value) noexcept
 Swaps the upper and lower bytes of a 16-bit integer. More...
 
static int32 swap (int32 value) noexcept
 Reverses the order of the 4 bytes in a 32-bit integer. More...
 
static int64 swap (int64 value) noexcept
 Reverses the order of the 8 bytes in a 64-bit integer. More...
 
constexpr 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...
 
template<typename Type >
static Type swapIfBigEndian (Type value) noexcept
 Swaps the byte order of a signed or unsigned integer if the CPU is big-endian. More...
 
template<typename Type >
static Type swapIfLittleEndian (Type value) noexcept
 Swaps the byte order of a signed or unsigned integer if the CPU is little-endian. More...
 

Private Member Functions

 ByteOrder ()=delete
 

Detailed Description

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

@tags{Core}

Constructor & Destructor Documentation

◆ ByteOrder()

juce::ByteOrder::ByteOrder ( )
privatedelete

Member Function Documentation

◆ bigEndian24Bit()

constexpr int32 juce::ByteOrder::bigEndian24Bit ( const void *  bytes)
inlinestaticconstexprnoexcept

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

◆ bigEndian24BitToChars()

void juce::ByteOrder::bigEndian24BitToChars ( int32  value,
void *  destBytes 
)
inlinestaticnoexcept

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

References juce::gl::value.

◆ bigEndianInt()

constexpr uint32 juce::ByteOrder::bigEndianInt ( const void *  bytes)
inlinestaticconstexprnoexcept

Turns 4 bytes into a big-endian integer.

◆ bigEndianInt64()

constexpr uint64 juce::ByteOrder::bigEndianInt64 ( const void *  bytes)
inlinestaticconstexprnoexcept

Turns 8 bytes into a big-endian integer.

◆ bigEndianShort()

constexpr uint16 juce::ByteOrder::bigEndianShort ( const void *  bytes)
inlinestaticconstexprnoexcept

Turns 2 bytes into a big-endian integer.

◆ isBigEndian()

constexpr static bool juce::ByteOrder::isBigEndian ( )
inlinestaticconstexprnoexcept

Returns true if the current CPU is big-endian.

◆ littleEndian24Bit()

constexpr int32 juce::ByteOrder::littleEndian24Bit ( const void *  bytes)
inlinestaticconstexprnoexcept

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

◆ littleEndian24BitToChars()

void juce::ByteOrder::littleEndian24BitToChars ( int32  value,
void *  destBytes 
)
inlinestaticnoexcept

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

References juce::gl::value.

◆ littleEndianInt()

constexpr uint32 juce::ByteOrder::littleEndianInt ( const void *  bytes)
inlinestaticconstexprnoexcept

Turns 4 bytes into a little-endian integer.

◆ littleEndianInt64()

constexpr uint64 juce::ByteOrder::littleEndianInt64 ( const void *  bytes)
inlinestaticconstexprnoexcept

Turns 8 bytes into a little-endian integer.

◆ littleEndianShort()

constexpr uint16 juce::ByteOrder::littleEndianShort ( const void *  bytes)
inlinestaticconstexprnoexcept

Turns 2 bytes into a little-endian integer.

◆ makeInt() [1/3]

constexpr uint64 juce::ByteOrder::makeInt ( uint8  leastSig,
uint8  byte1,
uint8  byte2,
uint8  byte3,
uint8  byte4,
uint8  byte5,
uint8  byte6,
uint8  mostSig 
)
inlinestaticconstexprnoexcept

Constructs a 64-bit integer from its constituent bytes, in order of significance.

◆ makeInt() [2/3]

constexpr uint32 juce::ByteOrder::makeInt ( uint8  leastSig,
uint8  byte1,
uint8  byte2,
uint8  mostSig 
)
inlinestaticconstexprnoexcept

Constructs a 32-bit integer from its constituent bytes, in order of significance.

◆ makeInt() [3/3]

constexpr uint16 juce::ByteOrder::makeInt ( uint8  leastSig,
uint8  mostSig 
)
inlinestaticconstexprnoexcept

Constructs a 16-bit integer from its constituent bytes, in order of significance.

◆ swap() [1/8]

double juce::ByteOrder::swap ( double  value)
inlinestaticnoexcept

Returns a garbled double which has the reverse byte-order of the original.

References juce::gl::n, and juce::gl::v.

◆ swap() [2/8]

float juce::ByteOrder::swap ( float  value)
inlinestaticnoexcept

Returns a garbled float which has the reverse byte-order of the original.

References juce::gl::n, and juce::gl::v.

◆ swap() [3/8]

constexpr int16 juce::ByteOrder::swap ( int16  value)
inlinestaticconstexprnoexcept

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

References juce::gl::v.

◆ swap() [4/8]

int32 juce::ByteOrder::swap ( int32  value)
inlinestaticnoexcept

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

References juce::gl::v.

◆ swap() [5/8]

int64 juce::ByteOrder::swap ( int64  value)
inlinestaticnoexcept

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

References juce::gl::v.

◆ swap() [6/8]

constexpr uint16 juce::ByteOrder::swap ( uint16  value)
inlinestaticconstexprnoexcept

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

References juce::gl::v.

◆ swap() [7/8]

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

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

References juce::gl::n.

◆ swap() [8/8]

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

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

References juce::gl::value.

◆ swapIfBigEndian()

template<typename Type >
static Type juce::ByteOrder::swapIfBigEndian ( Type  value)
inlinestaticnoexcept

Swaps the byte order of a signed or unsigned integer if the CPU is big-endian.

References juce::gl::value.

◆ swapIfLittleEndian()

template<typename Type >
static Type juce::ByteOrder::swapIfLittleEndian ( Type  value)
inlinestaticnoexcept

Swaps the byte order of a signed or unsigned integer if the CPU is little-endian.

References juce::gl::value.


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