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
bufferSpecifies a 32-bit (4 bytes) quantity.
Description
The swap_lw_bytes routine performs a long word byte swap. The swap_word_bytes routine performs a short word byte swap. The swap_words 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 swap_lw_bytes routine takes the 32-bit quantity specified by the buffer argument and swaps all four bytes. The swap_word_bytes routine takes the 32-bit quantity specified by the buffer argument and swaps the individual bytes that make up each byte of the 32-bit quantity. The swap_words 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.