-
Notifications
You must be signed in to change notification settings - Fork 0
/
HEX.PAS
executable file
·45 lines (36 loc) · 1.03 KB
/
HEX.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(****************************************************************************
* “⨫¨âë ¤«ï à ¡®âë á 16-â¨à¨ç®© á¨á⥬®© áç¨á«¥¨ï v1.00 beta 2 *
* *
****************************************************************************
* (C) NiKe'Soft *
****************************************************************************)
Unit hex;
INTERFACE
Function HexB(B: Byte): string;
Function HexW(W: Word): string;
Function HexL(L: longint): string;
IMPLEMENTATION
Function HexB(B: Byte): string;
Const Digits: array[0..15] of char = '0123456789ABCDEF';
begin
HexB[0]:=#2;
HexB[1]:=Digits[B SHR 4];
HexB[2]:=DIgits[B AND $0F];
end;
Function HexW(W: Word): string;
var s: string;
begin
s:='';
S:=HexB(W SHR 8);
S:=S+HexB(W AND $00FF);
HexW:=S;
end;
Function HexL(L: longint): string;
var s: string;
begin
s:='';
S:=HexW(l shr 16);
S:=S+HexW(l AND $0000FFFF);
HexL:=S;
end;
end.