]>
Commit | Line | Data |
---|---|---|
f6bcfd97 BP |
1 | ; crc_lcc.asm, optimized CRC calculation function for Zip and UnZip, not |
2 | ; copyrighted by Paul Kienitz and Christian Spieler. Last revised 25 Mar 98. | |
3 | ; | |
4 | ; The code in this file has been copied verbatim from crc_i386.{asm|S}; | |
5 | ; only the assembler syntax and metacommands have been adapted to | |
6 | ; the habits of the free LCC-Win32 C compiler package. | |
7 | ; This version of the code uses the "optimized for i686" variant of | |
8 | ; crc_i386.{asm|S}. | |
9 | ; | |
10 | ; For more information (and a revision log), look into the original | |
11 | ; source files. | |
12 | ; | |
13 | .text | |
14 | .file "crc32.c" | |
15 | .text | |
16 | .type _crc32,function | |
17 | _crc32: | |
18 | pushl %ebp | |
19 | movl %esp,%ebp | |
20 | pushl %ecx | |
21 | pushl %ebx | |
22 | pushl %esi | |
23 | pushl %edi | |
24 | .line 34 | |
25 | .line 37 | |
26 | movl 12(%ebp),%esi | |
27 | subl %eax,%eax | |
28 | testl %esi,%esi | |
29 | jz _$3 | |
30 | .line 39 | |
31 | call _get_crc_table | |
32 | movl %eax,%edi | |
33 | .line 41 | |
34 | movl 8(%ebp),%eax | |
35 | movl 16(%ebp),%ecx | |
36 | notl %eax | |
37 | testl %ecx,%ecx | |
38 | jz _$4 | |
39 | _$5: | |
40 | testl $3,%esi | |
41 | jz _$6 | |
42 | xorb (%esi),%al | |
43 | incl %esi | |
44 | movzbl %al,%ebx | |
45 | shrl $8,%eax | |
46 | xorl (%edi,%ebx,4),%eax | |
47 | decl %ecx | |
48 | jnz _$5 | |
49 | _$6: | |
50 | movl %ecx,%edx | |
51 | andl $7,%edx | |
52 | shrl $3,%ecx | |
53 | jz _$8 | |
54 | _$7: | |
55 | xorl (%esi),%eax | |
56 | addl $4,%esi | |
57 | movzbl %al,%ebx | |
58 | shrl $8,%eax | |
59 | xorl (%edi,%ebx,4),%eax | |
60 | movzbl %al,%ebx | |
61 | shrl $8,%eax | |
62 | xorl (%edi,%ebx,4),%eax | |
63 | movzbl %al,%ebx | |
64 | shrl $8,%eax | |
65 | xorl (%edi,%ebx,4),%eax | |
66 | movzbl %al,%ebx | |
67 | shrl $8,%eax | |
68 | xorl (%edi,%ebx,4),%eax | |
69 | xorl (%esi),%eax | |
70 | addl $4,%esi | |
71 | movzbl %al,%ebx | |
72 | shrl $8,%eax | |
73 | xorl (%edi,%ebx,4),%eax | |
74 | movzbl %al,%ebx | |
75 | shrl $8,%eax | |
76 | xorl (%edi,%ebx,4),%eax | |
77 | movzbl %al,%ebx | |
78 | shrl $8,%eax | |
79 | xorl (%edi,%ebx,4),%eax | |
80 | movzbl %al,%ebx | |
81 | shrl $8,%eax | |
82 | xorl (%edi,%ebx,4),%eax | |
83 | decl %ecx | |
84 | jnz _$7 | |
85 | _$8: | |
86 | movl %edx,%ecx | |
87 | jecxz _$4 | |
88 | _$9: | |
89 | xorb (%esi),%al | |
90 | incl %esi | |
91 | movzbl %al,%ebx | |
92 | shrl $8,%eax | |
93 | xorl (%edi,%ebx,4),%eax | |
94 | decl %ecx | |
95 | jnz _$9 | |
96 | _$4: | |
97 | xorl $0xffffffff,%eax | |
98 | _$3: | |
99 | .line 52 | |
100 | popl %edi | |
101 | popl %esi | |
102 | popl %ebx | |
103 | leave | |
104 | ret | |
105 | _$34: | |
106 | .size _crc32,_$34-_crc32 | |
107 | .globl _crc32 | |
108 | .extern _get_crc_table |