Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
589 | diamond | 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: |
||
19 | ; in: ecx=size, esi->buffer |
||
20 | ; out: eax=crc |
||
21 | or eax, -1 |
||
22 | jecxz .end |
||
23 | .loop: |
||
24 | movzx edx, al |
||
25 | xor dl, byte [esi] |
||
26 | inc esi |
||
27 | shr eax, 8 |
||
28 | xor eax, [crc_table+edx*4] |
||
29 | loop .loop |
||
30 | .end: |
||
31 | xor eax, -1 |
||
32 | ret |