Chyba jednak przeceniłem swoje umiejętności. Przy probie dodania funkcji do programu wypluwa mi wszystkie możliwe błędy. Czy mogę prosić o pomoc i wytłumaczenie. Poniżej podaje kod obu klas.
Kopiuj
strict private Crc8 = class
function Crc8.Count(data: Byte[]): Byte;
begin
Result := Crc8.Count(0, data)
end;
function Crc8.Count(initValue: Byte; data: Byte[]): Byte;
begin
Result := Crc8.Count(initValue, data, 0, data.Length)
end;
function Crc8.Count(data: Byte[]; start: Integer; length: Integer): Byte;
begin
Result := Crc8.Count(0, data, start, length)
end;
function Crc8.Count(initValue: Byte; data: Byte[]; start: Integer; length: Integer): Byte;
begin
num2 := initValue;
i := start;
while ((i < (start + length))) do
begin
num2 := Crc8._lookupTable[(data[i] xor num2)];
inc(i)
end;
begin
Result := num2;
exit
end
end;
strict private class var _lookupTable: Byte[] = New(array[$100] of Byte, ( (
0, $5e, $bc, $e2, $61, $3f, $dd, $83, $c2, $9c, $7e, $20, $a3, $fd, $1f, $41,
$9d, $c3, $21, $7f, $fc, $a2, $40, 30, $5f, 1, $e3, $bd, $3e, $60, 130, 220,
$23, $7d, $9f, $c1, $42, $1c, $fe, 160, $e1, $bf, $5d, 3, $80, $de, 60, $62,
190, $e0, 2, $5c, $df, $81, $63, $3d, $7c, $22, $c0, $9e, $1d, $43, $a1, $ff,
70, $18, 250, $a4, $27, $79, $9b, $c5, $84, $da, $38, $66, $e5, $bb, $59, 7,
$db, $85, $67, $39, $ba, $e4, 6, $58, $19, $47, $a5, $fb, 120, $26, $c4, $9a,
$65, $3b, $d9, $87, 4, 90, $b8, 230, $a7, $f9, $1b, $45, $c6, $98, $7a, $24,
$f8, $a6, $44, $1a, $99, $c7, $25, $7b, $3a, 100, $86, $d8, $5b, 5, $e7, $b9,
140, 210, $30, 110, $ed, $b3, $51, 15, $4e, $10, $f2, $ac, $2f, $71, $93, $cd,
$11, $4f, $ad, $f3, $70, $2e, $cc, $92, $d3, $8d, $6f, $31, $b2, $ec, 14, 80,
$af, $f1, $13, $4d, $ce, $90, $72, $2c, $6d, $33, $d1, $8f, 12, $52, $b0, $ee,
50, $6c, $8e, $d0, $53, 13, $ef, $b1, 240, $ae, $4c, $12, $91, $cf, $2d, $73,
$ca, $94, $76, 40, $ab, $f5, $17, $49, 8, $56, 180, $ea, $69, $37, $d5, $8b,
$57, 9, $eb, $b5, $36, $68, $8a, $d4, $95, $cb, $29, $77, $f4, 170, $48, $16,
$e9, $b7, $55, 11, $88, $d6, $34, $6a, $2b, $75, $97, $c9, $4a, 20, $f6, $a8,
$74, $2a, 200, 150, $15, $4b, $a9, $f7, $b6, $e8, 10, $54, $d7, $89, $6b, $35
) ));
end;
to jest kod który odczytałem z reflektora.
Jak to czytać, jak przenosić do normalnego unita, na co zwrócić uwagę.