Subversion Repositories Kolibri OS

Rev

Rev 6883 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. init_crc_table:
  2.         xor     edx, edx
  3.         mov     edi, crc_table
  4. .1:
  5.         mov     ecx, 8
  6.         mov     eax, edx
  7. .2:
  8.         shr     eax, 1
  9.         jnc     @f
  10.         xor     eax, 0xEDB88320
  11. @@:
  12.         loop    .2
  13.         stosd
  14.         inc     dl
  15.         jnz     .1
  16.         ret
  17.  
  18. crc_continue:
  19. ; in: eax = pervios crc, ecx = size, esi->buffer
  20. ; out: eax = crc
  21.         xor     eax, -1
  22.         jecxz   crc.end
  23.         jmp     crc.loop
  24.  
  25. crc:
  26. ; in: ecx=size, esi->buffer
  27. ; out: eax=crc
  28.         or      eax, -1
  29.         jecxz   .end
  30. .loop:
  31.         movzx   edx, al
  32.         xor     dl, byte [esi]
  33.         inc     esi
  34.         shr     eax, 8
  35.         xor     eax, [crc_table+edx*4]
  36.         loop    .loop
  37. .end:
  38.         xor     eax, -1
  39.         ret
  40.