SWAP - Swap high and low parts of a variable

Language reference ›› Built-in procedures ›› Miscellaneous variable treatments ››
Parent Previous Next

SWAP(variable)

Swap high and low part of a variable.


For 8-bit BYTE, CHAR or SHORTINT variables, it swaps low and high 4-bit nibbles.

For 16-bit INTEGER or WORD variables, it swaps low and high 8-bit.

For 32-bit LONGINT or LONGWORD variables, it swaps low and high 16-bit.

Other types are not supported.