const
HexB0:
array[#0..'
F']
of Byte =
// ist egal, daß es nicht bis 255 geht
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 0, 0, 10, 11, 12, 13, 14,
15);
HexB1:
array['
0'..'
F']
of Byte =
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15);
HexI0:
array[#0..'
F']
of Integer =
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
0, 0, 0, 0, 0, 10, 11, 12, 13, 14,
15);
HexI1:
array['
0'..'
F']
of Integer =
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15);
HexX:
array[0..15]
of AnsiChar = '
0123456789ABCDEF';
var
HexS:
array[AnsiChar]
of Byte;
HexD:
array of Byte;
procedure TForm22.FormCreate(Sender: TObject);
var
C: AnsiChar;
T: Cardinal;
i, X, L, A, B: Integer;
S: AnsiString;
P: PAnsiChar;
begin
A := 300000000;
B := 300000000;
// Hochheizen
for i := A * 3
downto 0
do ;
SetLength(HexD, 256);
for i := 0
to 255
do begin
HexS[AnsiChar(i)] := 0;
HexD[ i ] := 0;
end;
for i := 0
to 9
do begin
HexS[AnsiChar(Ord('
0') + i)] := i;
HexD[ Ord('
0') + i ] := i;
end;
for i := 0
to 5
do begin
HexS[AnsiChar(Ord('
A') + i)] := i + 10;
HexD[ Ord('
A') + i ] := i + 10;
end;
SetLength(S, B);
for i := 1
to B
do
S[i] := HexX[Random(16)];
P := PAnsiChar(S);
for L := 0
to 1
do begin
if L = 0
then Tag := Ord('
3')
else Tag := Ord('
B');
Memo1.Lines.Add('
');
Memo1.Lines.Add(Chr(Tag) + '
:');
Memo1.Lines.Add('
');
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := HexB0[C];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexB0 = ' + IntToStr(GetTickCount - T));
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := HexB1[C];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexB1 = ' + IntToStr(GetTickCount - T));
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := HexI0[C];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexI0 = ' + IntToStr(GetTickCount - T));
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := HexI1[C];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexI1 = ' + IntToStr(GetTickCount - T));
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := HexS[C];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexS = ' + IntToStr(GetTickCount - T));
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := HexD[Ord(C)];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexD = ' + IntToStr(GetTickCount - T));
C := AnsiChar(Tag);
T := GetTickCount;
for i := A
downto 0
do begin
X := Ord(C) - 48;
if X > 10
then Dec(X, 17);
if X = 0
then ;
end;
Memo1.Lines.Add('
Math = ' + IntToStr(GetTickCount - T));
end;
begin
Memo1.Lines.Add('
');
Memo1.Lines.Add('
Random:');
Memo1.Lines.Add('
');
T := GetTickCount;
for i := B
downto 0
do begin
X := HexB0[P[i]];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexB0 = ' + IntToStr(GetTickCount - T));
T := GetTickCount;
for i := B
downto 0
do begin
X := HexB1[P[i]];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexB1 = ' + IntToStr(GetTickCount - T));
T := GetTickCount;
for i := B
downto 0
do begin
X := HexI0[P[i]];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexI0 = ' + IntToStr(GetTickCount - T));
T := GetTickCount;
for i := B
downto 0
do begin
X := HexI1[P[i]];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexI1 = ' + IntToStr(GetTickCount - T));
T := GetTickCount;
for i := B
downto 0
do begin
X := HexS[P[i]];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexS = ' + IntToStr(GetTickCount - T));
T := GetTickCount;
for i := B
downto 0
do begin
X := HexD[Ord(P[i])];
if X = 0
then ;
end;
Memo1.Lines.Add('
HexD = ' + IntToStr(GetTickCount - T));
T := GetTickCount;
for i := B
downto 0
do begin
X := Ord(P[i]) - 48;
if X > 10
then Dec(X, 17);
if X = 0
then ;
end;
Memo1.Lines.Add('
Math = ' + IntToStr(GetTickCount - T));
end;
end;