[Overview][Constants][Types][Classes][Procedures and functions][Variables] |
Swap high and low bytes/words of a variable
Source position: line 0
function swap( |
X: Word |
):Word; |
X: Integer |
):Integer; |
X: LongInt |
):LongInt; |
X: Cardinal |
):Cardinal; |
X: QWord |
):QWord; |
X: Int64 |
):Int64; |
Swapswaps the high and low order bytes of Xif Xis of type Wordor Integer, or swaps the high and low order words of Xif Xis of type Longintor Cardinal. The return type is the type of X
None.
|
Return low byte/word of value. |
|
|
Return high byte/word of value. |
Program Example69; { Program to demonstrate the Swap function. } Var W : Word; L : Longint; begin W:=$1234; W:=Swap(W); if W<>$3412 then writeln ('Error when swapping word !'); L:=$12345678; L:=Swap(L); if L<>$56781234 then writeln ('Error when swapping Longint !'); end.