Swap Bytes Function
- Updated2025-07-30
- 2 minute(s) read
Swaps the high-order 8 bits and the low-order 8 bits for every word in data.
If you want to byte-swap floating-point or fixed-point numbers, use the Type Cast function to cast the value to a 1D array of bytes by wiring an array of numeric controls to the type input and the floating-point or fixed-point numbers to the x input. Then use the Reverse 1D Array function to convert the array to a floating-point number with the elements reversed. The connector pane displays the default data types for this polymorphic function.

Inputs/Outputs
data
—
data is an integer, an array of integers, or a cluster containing integers that you want to byte swap. If data is a cluster that contains integers, this function swaps only the integer elements of the cluster. Neither refnums or variants are valid inputs. Both will break the input wire.
byte swapped
—
byte swapped is of the same data type and structure as data. |
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
| Single-Cycle Timed Loop | Supported. |
| Usage | You cannot wire a fixed-point data type to this function. |
| Timing | This function requires no clock cycles to execute because it does not include an internal register. |
| Resources | This function consumes no FPGA resources because it is purely a wiring operation. |
data
—
byte swapped
—