Subversion Repositories Kolibri OS

Rev

Rev 6673 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6673 Rev 6881
Line 15... Line 15...
15
;  first call get_crc_table() to initialize the tables before allowing more than
15
;  first call get_crc_table() to initialize the tables before allowing more than
16
;  one thread to use crc32().
16
;  one thread to use crc32().
Line 17... Line 17...
17
 
17
 
Line 18... Line -...
18
; Definitions for doing the crc four data bytes at a time.
-
 
19
 
-
 
20
TBLS equ 1
18
; Definitions for doing the crc four data bytes at a time.
Line 21... Line 19...
21
 
19
 
22
if DYNAMIC_CRC_TABLE eq 1
20
if DYNAMIC_CRC_TABLE eq 1
23
 
-
 
24
align 4
-
 
Line 25... Line 21...
25
crc_table_empty dd 1
21
 
26
;align 4
22
align 4
Line 27... Line 23...
27
;crc_table rd TBLS*256
23
crc_table_empty dd 1
Line 98... Line 94...
98
	mov eax,crc_table
94
	mov eax,crc_table
99
	ret
95
	ret
100
endp
96
endp
Line 101... Line 97...
101
 
97
 
102
; =========================================================================
98
; =========================================================================
103
;unsigned long (crc, buf, len)
-
 
104
;    unsigned long crc
-
 
105
;    unsigned char *buf
-
 
106
;    uInt len
99
;unsigned long (unsigned long crc, unsigned char *buf, uInt len)
107
align 4
100
align 4
108
proc calc_crc32 uses ecx esi, p1crc:dword, buf:dword, len:dword
101
proc calc_crc32 uses ecx esi, p1crc:dword, buf:dword, len:dword
109
	xor eax,eax
102
	xor eax,eax
110
	mov esi,[buf]
-
 
-
 
103
	mov esi,[buf]
111
zlib_debug 'calc_crc32 buf = %d',esi
104
 
112
	cmp esi,Z_NULL
105
	cmp esi,Z_NULL
Line 113... Line 106...
113
	je .end_f ;if (..==0) return 0
106
	je .end_f ;if (..==0) return 0
114
 
107
 
Line 119... Line 112...
119
	@@:
112
	@@:
120
end if
113
end if
Line 121... Line 114...
121
 
114
 
122
	mov eax,[p1crc]
115
	mov eax,[p1crc]
-
 
116
	mov ecx,[len]
123
	mov ecx,[len]
117
	push edx
-
 
118
	call crc
124
	call crc
119
	pop edx
125
.end_f:
120
.end_f:
126
	ret
121
	ret
Line 127... Line 122...
127
endp
122
endp
Line 128... Line 123...
128
 
123
 
129
GF2_DIM equ 32 ;dimension of GF(2) vectors (length of CRC)
124
GF2_DIM equ 32 ;dimension of GF(2) vectors (length of CRC)
130
 
-
 
131
; =========================================================================
-
 
132
;unsigned long (mat, vec)
125
 
133
;    unsigned long *mat
126
; =========================================================================
134
;    unsigned long vec
127
;unsigned long (unsigned long *mat, unsigned long vec)
Line 135... Line 128...
135
align 4
128
align 4
Line 146... Line 139...
146
;    return sum;
139
;    return sum;
147
	ret
140
	ret
148
endp
141
endp
Line 149... Line 142...
149
 
142
 
150
; =========================================================================
143
; =========================================================================
151
;local void (square, mat)
-
 
152
;    unsigned long *square
-
 
153
;    unsigned long *mat
144
;local void (unsigned long *square, unsigned long *mat)
154
align 4
145
align 4
155
proc gf2_matrix_square, square:dword, mat:dword
146
proc gf2_matrix_square, square:dword, mat:dword
Line 156... Line 147...
156
;    int n;
147
;    int n;
157
 
148
 
158
;    for (n = 0; n < GF2_DIM; n++)
149
;    for (n = 0; n < GF2_DIM; n++)
159
;        square[n] = gf2_matrix_times(mat, mat[n]);
150
;        square[n] = gf2_matrix_times(mat, mat[n]);
Line 160... Line 151...
160
	ret
151
	ret
161
endp
152
endp
162
 
-
 
163
; =========================================================================
-
 
164
;uLong (crc1, crc2, len2)
-
 
165
;    uLong crc1
153
 
166
;    uLong crc2
154
; =========================================================================
167
;    z_off64_t len2
155
;uLong (uLong crc1, uLong crc2, z_off64_t len2)
168
align 4
156
align 4
169
proc crc32_combine_, crc1:dword, crc2:dword, len2:dword
157
proc crc32_combine_, crc1:dword, crc2:dword, len2:dword
Line 217... Line 205...
217
;    return crc1;
205
;    return crc1;
218
	ret
206
	ret
219
endp
207
endp
Line 220... Line 208...
220
 
208
 
221
; =========================================================================
209
; =========================================================================
222
;uLong (crc1, crc2, len2)
-
 
223
;    uLong crc1
-
 
224
;    uLong crc2
-
 
225
;    z_off_t len2
210
;uLong (uLong crc1, uLong crc2, z_off_t len2)
226
align 4
211
align 4
227
proc crc32_combine, crc1:dword, crc2:dword, len2:dword
212
proc crc32_combine, crc1:dword, crc2:dword, len2:dword
228
	stdcall crc32_combine_, [crc1], [crc2], [len2]
213
	stdcall crc32_combine_, [crc1], [crc2], [len2]
229
	ret
214
	ret
Line 230... Line 215...
230
endp
215
endp
231
 
-
 
232
;uLong (crc1, crc2, len2)
-
 
233
;    uLong crc1
-
 
234
;    uLong crc2
216
 
235
;    z_off64_t len2
217
;uLong (uLong crc1, uLong crc2, z_off64_t len2)
236
align 4
218
align 4
237
proc crc32_combine64, crc1:dword, crc2:dword, len2:dword
219
proc crc32_combine64, crc1:dword, crc2:dword, len2:dword
238
	stdcall crc32_combine_, [crc1], [crc2], [len2]
220
	stdcall crc32_combine_, [crc1], [crc2], [len2]