Loading...
Searching...
No Matches
juce::ByteOrder Class Reference

## Detailed Description

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

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

- juce_core/memory/juce_ByteOrder.h

## Static Public Member Functions

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

## Member Functions

## swap() [1/8]

uint16 juce::ByteOrder::swap | ( | uint16 | value | ) |

inline static constexpr noexcept

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

Referenced by swap(), swap(), swap(), swap(), swap(), swap(), swapIfBigEndian(), and swapIfLittleEndian().

## swap() [2/8]

int16 juce::ByteOrder::swap | ( | int16 | value | ) |

inline static constexpr noexcept

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

References swap().

## swap() [3/8]

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

inline static noexcept

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

## swap() [4/8]

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

inline static noexcept

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

References swap().

## swap() [5/8]

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

inline static noexcept

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

References swap().

## swap() [6/8]

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

inline static noexcept

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

References swap().

## swap() [7/8]

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

inline static noexcept

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

References swap().

## swap() [8/8]

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

inline static noexcept

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

References swap().

## swapIfBigEndian()

template<typename Type>

Type juce::ByteOrder::swapIfBigEndian | ( | Type | value | ) |

inline static noexcept

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

References swap().

## swapIfLittleEndian()

template<typename Type>

Type juce::ByteOrder::swapIfLittleEndian | ( | Type | value | ) |

inline static noexcept

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

References swap().

## littleEndianInt()

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

inline static constexpr noexcept

Turns 4 bytes into a little-endian integer.

References makeInt().

## littleEndianInt64()

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

inline static constexpr noexcept

Turns 8 bytes into a little-endian integer.

References makeInt().

## littleEndianShort()

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

inline static constexpr noexcept

Turns 2 bytes into a little-endian integer.

References makeInt().

## littleEndian24Bit()

int32 juce::ByteOrder::littleEndian24Bit | ( | const void * | bytes | ) |

inline static constexpr noexcept

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 )

inline static noexcept

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

## bigEndianInt()

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

inline static constexpr noexcept

Turns 4 bytes into a big-endian integer.

References makeInt().

## bigEndianInt64()

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

inline static constexpr noexcept

Turns 8 bytes into a big-endian integer.

References makeInt().

## bigEndianShort()

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

inline static constexpr noexcept

Turns 2 bytes into a big-endian integer.

References makeInt().

## bigEndian24Bit()

int32 juce::ByteOrder::bigEndian24Bit | ( | const void * | bytes | ) |

inline static constexpr noexcept

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 )

inline static noexcept

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

## makeInt() [1/3]

uint16 juce::ByteOrder::makeInt | ( | uint8 | leastSig,
|  | uint8 | mostSig )

inline static constexpr noexcept

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

Referenced by bigEndianInt(), bigEndianInt64(), bigEndianShort(), littleEndianInt(), littleEndianInt64(), and littleEndianShort().

## makeInt() [2/3]

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

inline static constexpr noexcept

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

## makeInt() [3/3]

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

inline static constexpr noexcept

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

## isBigEndian()

constexpr bool juce::ByteOrder::isBigEndian | ( |  | ) |

inline static constexpr noexcept

Returns true if the current CPU is big-endian.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited