[an error occurred while processing this directive]
|
///////////////Delphi///////////////////////////
unction DowCRC(x:byte): byte;
var
i:integer;
b:byte;
begin
for i:=0 to 8 do
begin
if b xor CRC and 1 <> 0
then CRC:=((CRC xor $18) shr 1) or $80
else CRC:=CRC shr 1;
end;
end;
/////////////////// C /////////////////////////////
void __fastcall DowCRC(unsigned char b, unsigned char &crc)
{ for (int i = 0; i < 8; i++)
{
if (((b ^ crc) & 1) != 0)
crc = ((crc ^ 0x18) >> 1) | 0x80;
else crc = (crc >> 1) & ~0x80;
b = b >> 1;
}
}
E-mail: info@telesys.ru