Subversion Repositories Kolibri OS

Rev

Rev 589 | Go to most recent revision | 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.                 jmp crc.loop
  23.  
  24. crc:
  25. ; in: ecx=size, esi->buffer
  26. ; out: eax=crc
  27.         or      eax, -1
  28.         jecxz   .end
  29. .loop:
  30.         movzx   edx, al
  31.         xor     dl, byte [esi]
  32.         inc     esi
  33.         shr     eax, 8
  34.         xor     eax, [crc_table+edx*4]
  35.         loop    .loop
  36. .end:
  37.         xor     eax, -1
  38.         ret
  39.