swap_lw_bytes(3) Library Functions Manual swap_lw_bytes(3)
Name
swap_lw_bytes, swap_word_bytes, swap_words - perform byte swapping operations
Syntax
unsigned int swap_lw_bytes(buffer)
unsigned int buffer;
unsigned int swap_word_bytes(buffer)
unsigned int buffer;
unsigned int swap_words(buffer)
unsigned int buffer;
Arguments
buffer Specifies a 32-bit (4 bytes) quantity.
Description
The routine performs a long word byte swap. The routine performs a short word byte swap. The routine performs a word byte swap. Because
Digital devices support the little endian model of byte ordering, there is a need for these byte swapping routines.
For the purposes of the following discussion, a long word is equal to 4 bytes; a short word is equal to 2 bytes; and 1 byte is equal to 8
bits. The routine takes the 32-bit quantity specified by the buffer argument and swaps all four bytes. The routine takes the 32-bit quan-
tity specified by the buffer argument and swaps the individual bytes that make up each byte of the 32-bit quantity. The routine takes the
32-bit quantity specified by the buffer argument and swaps the two words.
Return Values
These routines return the result of the byte swapping.
swap_lw_bytes(3)