Starboard Module Reference: byte_swap.h
Stay organized with collections
Save and categorize content based on your preferences.
Specifies functions for swapping byte order. These functions are used to deal
with endianness when performing I/O.
Functions
SbByteSwapS16
Unconditionally swaps the byte order in signed 16-bit value
. value
: The
value for which the byte order will be swapped.
Declaration
int16_t SbByteSwapS16(int16_t value)
SbByteSwapS32
Unconditionally swaps the byte order in signed 32-bit value
. value
: The
value for which the byte order will be swapped.
Declaration
int32_t SbByteSwapS32(int32_t value)
SbByteSwapS64
Unconditionally swaps the byte order in signed 64-bit value
. value
: The
value for which the byte order will be swapped.
Declaration
int64_t SbByteSwapS64(int64_t value)
SbByteSwapU16
Unconditionally swaps the byte order in unsigned 16-bit value
. value
: The
value for which the byte order will be swapped.
Declaration
uint16_t SbByteSwapU16(uint16_t value)
SbByteSwapU32
Unconditionally swaps the byte order in unsigned 32-bit value
. value
: The
value for which the byte order will be swapped.
Declaration
uint32_t SbByteSwapU32(uint32_t value)
SbByteSwapU64
Unconditionally swaps the byte order in unsigned 64-bit value
. value
: The
value for which the byte order will be swapped.
Declaration
uint64_t SbByteSwapU64(uint64_t value)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-12-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-12-12 UTC."],[[["The functions provided facilitate swapping byte order (endianness) for signed and unsigned integers of various sizes (16-bit, 32-bit, and 64-bit)."],["These functions are primarily utilized to ensure data consistency when performing input/output (I/O) operations, especially when dealing with systems or platforms having different endianness."],["Each function unconditionally swaps the byte order of the input value, regardless of the current system's endianness."],["The functions are named according to the data type they operate on, such as `SbByteSwapS16` for signed 16-bit integers and `SbByteSwapU32` for unsigned 32-bit integers."],["Using these functions helps prevent data corruption and misinterpretation when transferring data between systems with different endianness during I/O operations."]]],["The provided content defines functions for byte order swapping, crucial for managing endianness during I/O operations. Six functions are detailed: `SbByteSwapS16`, `SbByteSwapS32`, and `SbByteSwapS64` swap the byte order of signed 16-bit, 32-bit, and 64-bit values, respectively. Similarly, `SbByteSwapU16`, `SbByteSwapU32`, and `SbByteSwapU64` perform the same operation on unsigned 16-bit, 32-bit, and 64-bit values. Each function takes a value as input and returns the byte-swapped result.\n"]]