Description |
The Hi function returns the high order byte of a 2 byte integer IntValue as a single byte.
|
|
Related commands |
Lo |
|
Returns the low-order byte of a (2 byte) Integer |
Shl |
|
Shift an integer value left by a number of bits |
Shr |
|
Shift an integer value right by a number of bits |
|
|
|
Example code : Illustrate Ho and Lo functions |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses // The System unit does not need to be defined SysUtils, Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
i : Integer;
begin i := $2345; // $2345 hex : $23 hi byte, $45 lo byte
ShowMessage(Format('Integer = $%x', [i]));
ShowMessage(Format('Hi byte = $%x', [Hi(i)]));
ShowMessage(Format('Lo byte = $%x', [Lo(i)]));
end; end.
|
Hide full unit code |
Integer = $2345
Hi byte = $23
Lo byte = $45
|
|