home *** CD-ROM | disk | FTP | other *** search
/ Megarom / Megarom Macintosh CD Software (Quantum Leap)(1992).iso / COMPRESS / DeHQX-200 / Source / CRCs.p < prev    next >
Encoding:
Text File  |  1991-08-23  |  418 b   |  29 lines  |  [TEXT/PJMM]

  1. unit CRCs;
  2. { DeHQX v2.0.0 © Peter Lewis, Aug 1991 }
  3.  
  4. interface
  5.  
  6.     procedure CalcCRC (var crc: integer; v: integer);
  7.  
  8. implementation
  9.  
  10. end.
  11.  
  12. procedure CalcCRC (v: integer);
  13.     var
  14.         temp: boolean;
  15.         i: integer;
  16. begin
  17. {$PUSH}
  18. {$V-}
  19.     for i := 1 to 8 do begin
  20.         temp := BAND(crc, $8000) <> 0;
  21.         crc := BOR(BSL(crc, 1), BSR(v, 7));
  22.         if temp then
  23.             crc := BXOR(crc, $1021);
  24.         v := BAND(BSL(v, 1), $FF);
  25.     end;
  26. {$POP}
  27. end;
  28.  
  29. end.