forked from KolibriOS/kolibrios
some fixes and optimize
git-svn-id: svn://kolibrios.org@6639 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
33fb425969
commit
830c466a98
@ -94,31 +94,11 @@ if DYNAMIC_CRC_TABLE eq 1
|
|||||||
je @f ;if (..)
|
je @f ;if (..)
|
||||||
call make_crc_table
|
call make_crc_table
|
||||||
@@:
|
@@:
|
||||||
end if ;DYNAMIC_CRC_TABLE
|
end if
|
||||||
mov eax,crc_table
|
mov eax,crc_table
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; =========================================================================
|
|
||||||
macro DO1
|
|
||||||
{
|
|
||||||
xor al,byte[esi]
|
|
||||||
xor al,ah
|
|
||||||
mov eax,[crc_table+eax*4]
|
|
||||||
inc esi
|
|
||||||
}
|
|
||||||
macro DO8
|
|
||||||
{
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
DO1
|
|
||||||
}
|
|
||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;unsigned long (crc, buf, len)
|
;unsigned long (crc, buf, len)
|
||||||
; unsigned long crc
|
; unsigned long crc
|
||||||
@ -140,26 +120,8 @@ if DYNAMIC_CRC_TABLE eq 1
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
mov eax,[p1crc]
|
mov eax,[p1crc]
|
||||||
xor eax,0xffffffff
|
|
||||||
mov [p1crc],eax
|
|
||||||
mov ecx,[len]
|
mov ecx,[len]
|
||||||
align 4
|
call crc
|
||||||
.cycle0:
|
|
||||||
cmp ecx,8
|
|
||||||
jl @f
|
|
||||||
DO8
|
|
||||||
sub ecx,8
|
|
||||||
jmp .cycle0
|
|
||||||
align 4
|
|
||||||
@@:
|
|
||||||
cmp ecx,1
|
|
||||||
jl @f
|
|
||||||
DO1
|
|
||||||
dec ecx
|
|
||||||
jmp @b
|
|
||||||
@@:
|
|
||||||
mov eax,[p1crc]
|
|
||||||
xor eax,0xffffffff
|
|
||||||
.end_f:
|
.end_f:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
@ -198,10 +198,10 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, level, version, stream_size)
|
;int (strm, level, version, stream_size)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; int level;
|
; int level
|
||||||
; const char *version;
|
; const char *version
|
||||||
; int stream_size;
|
; int stream_size
|
||||||
align 4
|
align 4
|
||||||
proc deflateInit_, strm:dword, level:dword, version:dword, stream_size:dword
|
proc deflateInit_, strm:dword, level:dword, version:dword, stream_size:dword
|
||||||
stdcall deflateInit2_, [strm], [level], Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,\
|
stdcall deflateInit2_, [strm], [level], Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,\
|
||||||
@ -220,14 +220,14 @@ endp
|
|||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, level, method, windowBits, memLevel, strategy,
|
;int (strm, level, method, windowBits, memLevel, strategy,
|
||||||
; version, stream_size)
|
; version, stream_size)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; int level;
|
; int level
|
||||||
; int method;
|
; int method
|
||||||
; int windowBits;
|
; int windowBits
|
||||||
; int memLevel;
|
; int memLevel
|
||||||
; int strategy;
|
; int strategy
|
||||||
; const char *version;
|
; const char *version
|
||||||
; int stream_size;
|
; int stream_size
|
||||||
align 4
|
align 4
|
||||||
proc deflateInit2_ uses ebx ecx edx edi, strm:dword, level:dword, method:dword,\
|
proc deflateInit2_ uses ebx ecx edx edi, strm:dword, level:dword, method:dword,\
|
||||||
windowBits:dword, memLevel:dword, strategy:dword, version:dword, stream_size:dword
|
windowBits:dword, memLevel:dword, strategy:dword, version:dword, stream_size:dword
|
||||||
@ -433,9 +433,9 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, dictionary, dictLength)
|
;int (strm, dictionary, dictLength)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; const Bytef *dictionary;
|
; const Bytef *dictionary
|
||||||
; uInt dictLength;
|
; uInt dictLength
|
||||||
align 4
|
align 4
|
||||||
proc deflateSetDictionary uses ebx edi, strm:dword, dictionary:dword, dictLength:dword
|
proc deflateSetDictionary uses ebx edi, strm:dword, dictionary:dword, dictLength:dword
|
||||||
locals
|
locals
|
||||||
@ -518,7 +518,7 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm)
|
;int (strm)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
align 4
|
align 4
|
||||||
proc deflateResetKeep uses ebx edi, strm:dword
|
proc deflateResetKeep uses ebx edi, strm:dword
|
||||||
; deflate_state *s;
|
; deflate_state *s;
|
||||||
@ -563,7 +563,7 @@ proc deflateResetKeep uses ebx edi, strm:dword
|
|||||||
if GZIP eq 1
|
if GZIP eq 1
|
||||||
cmp dword[edi+deflate_state.wrap],2
|
cmp dword[edi+deflate_state.wrap],2
|
||||||
jne @f
|
jne @f
|
||||||
stdcall calc_crc32, 0, Z_NULL, 0
|
xor eax,eax ;stdcall calc_crc32, 0, Z_NULL, 0
|
||||||
@@:
|
@@:
|
||||||
end if
|
end if
|
||||||
mov dword[ebx+z_stream.adler],eax
|
mov dword[ebx+z_stream.adler],eax
|
||||||
@ -578,11 +578,11 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm)
|
;int (strm)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
align 4
|
align 4
|
||||||
proc deflateReset uses ebx, strm:dword
|
proc deflateReset uses ebx, strm:dword
|
||||||
mov ebx,[strm]
|
mov ebx,[strm]
|
||||||
;zlib_debug 'deflateReset'
|
zlib_debug 'deflateReset'
|
||||||
stdcall deflateResetKeep, ebx
|
stdcall deflateResetKeep, ebx
|
||||||
cmp eax,0
|
cmp eax,0
|
||||||
jne @f ;if (..==Z_OK)
|
jne @f ;if (..==Z_OK)
|
||||||
@ -593,8 +593,8 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, head)
|
;int (strm, head)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; gz_headerp head;
|
; gz_headerp head
|
||||||
align 4
|
align 4
|
||||||
proc deflateSetHeader uses ebx, strm:dword, head:dword
|
proc deflateSetHeader uses ebx, strm:dword, head:dword
|
||||||
mov ebx,[strm]
|
mov ebx,[strm]
|
||||||
@ -621,9 +621,9 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, pending, bits)
|
;int (strm, pending, bits)
|
||||||
; unsigned *pending;
|
; unsigned *pending
|
||||||
; int *bits;
|
; int *bits
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
align 4
|
align 4
|
||||||
proc deflatePending uses ebx edi, strm:dword, pending:dword, bits:dword
|
proc deflatePending uses ebx edi, strm:dword, pending:dword, bits:dword
|
||||||
mov ebx,[strm]
|
mov ebx,[strm]
|
||||||
@ -655,9 +655,9 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, bits, value)
|
;int (strm, bits, value)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; int bits;
|
; int bits
|
||||||
; int value;
|
; int value
|
||||||
align 4
|
align 4
|
||||||
proc deflatePrime uses ebx edi, strm:dword, bits:dword, value:dword
|
proc deflatePrime uses ebx edi, strm:dword, bits:dword, value:dword
|
||||||
; int put;
|
; int put;
|
||||||
@ -691,9 +691,9 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, level, strategy)
|
;int (strm, level, strategy)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; int level;
|
; int level
|
||||||
; int strategy;
|
; int strategy
|
||||||
align 4
|
align 4
|
||||||
proc deflateParams uses ebx edi, strm:dword, level:dword, strategy:dword
|
proc deflateParams uses ebx edi, strm:dword, level:dword, strategy:dword
|
||||||
; compress_func func;
|
; compress_func func;
|
||||||
@ -748,11 +748,11 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, good_length, max_lazy, nice_length, max_chain)
|
;int (strm, good_length, max_lazy, nice_length, max_chain)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; int good_length;
|
; int good_length
|
||||||
; int max_lazy;
|
; int max_lazy
|
||||||
; int nice_length;
|
; int nice_length
|
||||||
; int max_chain;
|
; int max_chain
|
||||||
align 4
|
align 4
|
||||||
proc deflateTune uses ebx, strm:dword, good_length:dword, max_lazy:dword,\
|
proc deflateTune uses ebx, strm:dword, good_length:dword, max_lazy:dword,\
|
||||||
nice_length:dword, max_chain:dword
|
nice_length:dword, max_chain:dword
|
||||||
@ -797,14 +797,14 @@ endp
|
|||||||
; allocation.
|
; allocation.
|
||||||
|
|
||||||
;uLong (strm, sourceLen)
|
;uLong (strm, sourceLen)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; uLong sourceLen;
|
; uLong sourceLen
|
||||||
align 4
|
align 4
|
||||||
proc deflateBound, strm:dword, sourceLen:dword
|
proc deflateBound, strm:dword, sourceLen:dword
|
||||||
; deflate_state *s;
|
; deflate_state *s;
|
||||||
; uLong complen, wraplen;
|
; uLong complen, wraplen;
|
||||||
; Bytef *str;
|
; Bytef *str;
|
||||||
;zlib_debug 'deflateBound'
|
zlib_debug 'deflateBound'
|
||||||
|
|
||||||
; conservative upper bound for compressed data
|
; conservative upper bound for compressed data
|
||||||
; complen = sourceLen +
|
; complen = sourceLen +
|
||||||
@ -863,8 +863,8 @@ endp
|
|||||||
; pending_buf.
|
; pending_buf.
|
||||||
|
|
||||||
;void (s, b)
|
;void (s, b)
|
||||||
; deflate_state *s;
|
; deflate_state *s
|
||||||
; uInt b;
|
; uInt b
|
||||||
align 4
|
align 4
|
||||||
proc putShortMSB uses ebx ecx, s:dword, b:dword
|
proc putShortMSB uses ebx ecx, s:dword, b:dword
|
||||||
mov ebx,[s]
|
mov ebx,[s]
|
||||||
@ -881,13 +881,13 @@ endp
|
|||||||
; (See also read_buf()).
|
; (See also read_buf()).
|
||||||
|
|
||||||
;void (strm)
|
;void (strm)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
align 4
|
align 4
|
||||||
proc flush_pending uses eax ebx ecx edx, strm:dword
|
proc flush_pending uses eax ebx ecx edx, strm:dword
|
||||||
;ecx - len
|
;ecx - len
|
||||||
;edx - deflate_state *s
|
;edx - deflate_state *s
|
||||||
;ebx - strm
|
;ebx - strm
|
||||||
;zlib_debug 'flush_pending'
|
zlib_debug 'flush_pending'
|
||||||
mov ebx,[strm]
|
mov ebx,[strm]
|
||||||
mov edx,[ebx+z_stream.state]
|
mov edx,[ebx+z_stream.state]
|
||||||
|
|
||||||
@ -916,8 +916,8 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm, flush)
|
;int (strm, flush)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; int flush;
|
; int flush
|
||||||
align 4
|
align 4
|
||||||
proc deflate uses ebx ecx edx edi esi, strm:dword, flush:dword
|
proc deflate uses ebx ecx edx edi esi, strm:dword, flush:dword
|
||||||
locals
|
locals
|
||||||
@ -973,7 +973,7 @@ zlib_debug 'deflate strm = %d',ebx
|
|||||||
if GZIP eq 1
|
if GZIP eq 1
|
||||||
cmp dword[edi+deflate_state.wrap],2
|
cmp dword[edi+deflate_state.wrap],2
|
||||||
jne .end1 ;if (..==..)
|
jne .end1 ;if (..==..)
|
||||||
stdcall calc_crc32, 0, Z_NULL, 0
|
xor eax,eax ;stdcall calc_crc32, 0, Z_NULL, 0
|
||||||
mov [ebx+z_stream.adler],eax
|
mov [ebx+z_stream.adler],eax
|
||||||
put_byte edi, 31
|
put_byte edi, 31
|
||||||
put_byte edi, 139
|
put_byte edi, 139
|
||||||
@ -1107,7 +1107,7 @@ end if
|
|||||||
bswap ecx
|
bswap ecx
|
||||||
put_dword edi, ecx
|
put_dword edi, ecx
|
||||||
@@:
|
@@:
|
||||||
stdcall calc_crc32, 0, Z_NULL, 0
|
xor eax,eax ;stdcall calc_crc32, 0, Z_NULL, 0
|
||||||
mov [ebx+z_stream.adler],eax
|
mov [ebx+z_stream.adler],eax
|
||||||
.end2:
|
.end2:
|
||||||
if GZIP eq 1
|
if GZIP eq 1
|
||||||
@ -1307,7 +1307,7 @@ if GZIP eq 1
|
|||||||
mov ecx,[ebx+z_stream.adler]
|
mov ecx,[ebx+z_stream.adler]
|
||||||
put_byte edi, cl
|
put_byte edi, cl
|
||||||
put_byte edi, ch
|
put_byte edi, ch
|
||||||
stdcall calc_crc32, 0, Z_NULL, 0
|
xor eax,eax ;stdcall calc_crc32, 0, Z_NULL, 0
|
||||||
mov [ebx+z_stream.adler],eax
|
mov [ebx+z_stream.adler],eax
|
||||||
mov dword[edi+deflate_state.status],BUSY_STATE
|
mov dword[edi+deflate_state.status],BUSY_STATE
|
||||||
@@:
|
@@:
|
||||||
@ -1447,7 +1447,7 @@ end if
|
|||||||
.end11:
|
.end11:
|
||||||
cmp word[ebx+z_stream.avail_out],0
|
cmp word[ebx+z_stream.avail_out],0
|
||||||
jg @f
|
jg @f
|
||||||
zlib_debug 'bug2' ;Assert(..>0)
|
zlib_assert 'bug2' ;Assert(..>0)
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
cmp dword[flush],Z_FINISH
|
cmp dword[flush],Z_FINISH
|
||||||
@ -1496,7 +1496,7 @@ endp
|
|||||||
|
|
||||||
; =========================================================================
|
; =========================================================================
|
||||||
;int (strm)
|
;int (strm)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
align 4
|
align 4
|
||||||
proc deflateEnd uses ebx ecx edx, strm:dword
|
proc deflateEnd uses ebx ecx edx, strm:dword
|
||||||
mov ebx,[strm]
|
mov ebx,[strm]
|
||||||
@ -1553,15 +1553,13 @@ endp
|
|||||||
; doesn't have enough memory anyway to duplicate compression states).
|
; doesn't have enough memory anyway to duplicate compression states).
|
||||||
|
|
||||||
;int (dest, source)
|
;int (dest, source)
|
||||||
; z_streamp dest;
|
; z_streamp dest
|
||||||
; z_streamp source;
|
; z_streamp source
|
||||||
align 4
|
align 4
|
||||||
proc deflateCopy uses edx edi esi, dest:dword, source:dword
|
proc deflateCopy uses ebx edx edi esi, dest:dword, source:dword
|
||||||
locals
|
;ebx = overlay ;uint_16p
|
||||||
overlay dd ? ;uint_16p
|
;edi = ds ;deflate_state*
|
||||||
endl
|
;esi = ss ;deflate_state*
|
||||||
;edi = ds; deflate_state*
|
|
||||||
;esi = ss; deflate_state*
|
|
||||||
|
|
||||||
mov esi,[source]
|
mov esi,[source]
|
||||||
cmp esi,Z_NULL
|
cmp esi,Z_NULL
|
||||||
@ -1597,7 +1595,7 @@ endl
|
|||||||
ZALLOC edx, [edi+deflate_state.hash_size], 4 ;sizeof.dd
|
ZALLOC edx, [edi+deflate_state.hash_size], 4 ;sizeof.dd
|
||||||
mov dword[edi+deflate_state.head],eax
|
mov dword[edi+deflate_state.head],eax
|
||||||
ZALLOC edx, [edi+deflate_state.lit_bufsize], 4 ;sizeof.dw+2
|
ZALLOC edx, [edi+deflate_state.lit_bufsize], 4 ;sizeof.dw+2
|
||||||
mov [overlay],eax
|
mov ebx,eax
|
||||||
mov dword[edi+deflate_state.pending_buf],eax
|
mov dword[edi+deflate_state.pending_buf],eax
|
||||||
|
|
||||||
cmp dword[edi+deflate_state.window],Z_NULL
|
cmp dword[edi+deflate_state.window],Z_NULL
|
||||||
@ -1618,13 +1616,26 @@ endl
|
|||||||
mov eax,[edi+deflate_state.w_size]
|
mov eax,[edi+deflate_state.w_size]
|
||||||
shl eax,1 ;*= 2*sizeof.db
|
shl eax,1 ;*= 2*sizeof.db
|
||||||
stdcall zmemcpy, [edi+deflate_state.window], [esi+deflate_state.window], eax
|
stdcall zmemcpy, [edi+deflate_state.window], [esi+deflate_state.window], eax
|
||||||
; zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
|
mov eax,[edi+deflate_state.w_size]
|
||||||
; zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
|
shl eax,2 ;*= sizeof.dd
|
||||||
; zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
stdcall zmemcpy, [edi+deflate_state.prev], [esi+deflate_state.prev], eax
|
||||||
|
mov eax,[edi+deflate_state.hash_size]
|
||||||
|
shl eax,2 ;*= sizeof.dd
|
||||||
|
stdcall zmemcpy, [edi+deflate_state.head], [esi+deflate_state.head], eax
|
||||||
|
stdcall zmemcpy, [edi+deflate_state.pending_buf], [esi+deflate_state.pending_buf], [edi+deflate_state.pending_buf_size]
|
||||||
|
|
||||||
; ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
mov eax,[edi+deflate_state.pending_buf]
|
||||||
; ds->d_buf = overlay + ds->lit_bufsize/sizeof(uint_16);
|
add eax,[esi+deflate_state.pending_out]
|
||||||
; ds->l_buf = ds->pending_buf + (1+sizeof(uint_16))*ds->lit_bufsize;
|
sub eax,[esi+deflate_state.pending_buf]
|
||||||
|
mov [edi+deflate_state.pending_out],eax
|
||||||
|
mov eax,[edi+deflate_state.lit_bufsize]
|
||||||
|
shr eax,1 ;/=sizeof.uint_16
|
||||||
|
add eax,ebx
|
||||||
|
mov [edi+deflate_state.d_buf],eax
|
||||||
|
mov eax,[edi+deflate_state.lit_bufsize]
|
||||||
|
imul eax,3 ;*=1+sizeof.uint_16
|
||||||
|
add eax,[edi+deflate_state.pending_buf]
|
||||||
|
mov [edi+deflate_state.l_buf],eax
|
||||||
|
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
add eax,deflate_state.dyn_ltree
|
add eax,deflate_state.dyn_ltree
|
||||||
@ -1647,9 +1658,9 @@ endp
|
|||||||
; (See also flush_pending()).
|
; (See also flush_pending()).
|
||||||
|
|
||||||
;int (strm, buf, size)
|
;int (strm, buf, size)
|
||||||
; z_streamp strm;
|
; z_streamp strm
|
||||||
; Bytef *buf;
|
; Bytef *buf
|
||||||
; unsigned size;
|
; unsigned size
|
||||||
align 4
|
align 4
|
||||||
proc read_buf uses ebx ecx, strm:dword, buf:dword, size:dword
|
proc read_buf uses ebx ecx, strm:dword, buf:dword, size:dword
|
||||||
mov ebx,[strm]
|
mov ebx,[strm]
|
||||||
@ -1739,8 +1750,8 @@ end if
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;uInt (s, cur_match)
|
;uInt (s, cur_match)
|
||||||
; deflate_state *s;
|
; deflate_state *s
|
||||||
; IPos cur_match; /* current match */
|
; IPos cur_match ;current match
|
||||||
align 4
|
align 4
|
||||||
proc longest_match uses ebx ecx edx edi esi, s:dword, cur_match:dword
|
proc longest_match uses ebx ecx edx edi esi, s:dword, cur_match:dword
|
||||||
if FASTEST eq 0
|
if FASTEST eq 0
|
||||||
@ -1771,18 +1782,9 @@ if FASTEST eq 0
|
|||||||
; Posf *prev = s->prev;
|
; Posf *prev = s->prev;
|
||||||
; uInt wmask = s->w_mask;
|
; uInt wmask = s->w_mask;
|
||||||
|
|
||||||
if UNALIGNED_OK eq 1
|
|
||||||
; Compare two bytes at a time. Note: this is not always beneficial.
|
|
||||||
; Try with and without -DUNALIGNED_OK to check.
|
|
||||||
|
|
||||||
; register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
|
|
||||||
; register uint_16 scan_start = *(uint_16p*)scan;
|
|
||||||
; register uint_16 scan_end = *(uint_16p*)(scan+best_len-1);
|
|
||||||
else
|
|
||||||
; register Bytef *strend = s->window + s->strstart + MAX_MATCH;
|
; register Bytef *strend = s->window + s->strstart + MAX_MATCH;
|
||||||
; register Byte scan_end1 = scan[best_len-1];
|
; register Byte scan_end1 = scan[best_len-1];
|
||||||
; register Byte scan_end = scan[best_len];
|
; register Byte scan_end = scan[best_len];
|
||||||
end if
|
|
||||||
|
|
||||||
; The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
; The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
||||||
; It is easy to get rid of this optimization if necessary.
|
; It is easy to get rid of this optimization if necessary.
|
||||||
@ -1812,41 +1814,6 @@ end if
|
|||||||
; However the length of the match is limited to the lookahead, so
|
; However the length of the match is limited to the lookahead, so
|
||||||
; the output of deflate is not affected by the uninitialized values.
|
; the output of deflate is not affected by the uninitialized values.
|
||||||
|
|
||||||
if ((UNALIGNED_OK eq 1) & MAX_MATCH == 258)
|
|
||||||
; This code assumes sizeof(unsigned short) == 2. Do not use
|
|
||||||
; UNALIGNED_OK if your compiler uses a different size.
|
|
||||||
|
|
||||||
; if (*(uint_16p*)(match+best_len-1) != scan_end ||
|
|
||||||
; *(uint_16p*)match != scan_start) continue;
|
|
||||||
|
|
||||||
; It is not necessary to compare scan[2] and match[2] since they are
|
|
||||||
; always equal when the other bytes match, given that the hash keys
|
|
||||||
; are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
|
|
||||||
; strstart+3, +5, ... up to strstart+257. We check for insufficient
|
|
||||||
; lookahead only every 4th comparison; the 128th check will be made
|
|
||||||
; at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
|
|
||||||
; necessary to put more guard bytes at the end of the window, or
|
|
||||||
; to check more often for insufficient lookahead.
|
|
||||||
|
|
||||||
; Assert(scan[2] == match[2], "scan[2]?");
|
|
||||||
; scan++, match++;
|
|
||||||
; do {
|
|
||||||
; } while (*(uint_16p*)(scan+=2) == *(uint_16p*)(match+=2) &&
|
|
||||||
; *(uint_16p*)(scan+=2) == *(uint_16p*)(match+=2) &&
|
|
||||||
; *(uint_16p*)(scan+=2) == *(uint_16p*)(match+=2) &&
|
|
||||||
; *(uint_16p*)(scan+=2) == *(uint_16p*)(match+=2) &&
|
|
||||||
; scan < strend);
|
|
||||||
; The funny "do {}" generates better code on most compilers
|
|
||||||
|
|
||||||
; Here, scan <= window+strstart+257
|
|
||||||
; Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
|
||||||
; if (*scan == *match) scan++;
|
|
||||||
|
|
||||||
; len = (MAX_MATCH - 1) - (int)(strend-scan);
|
|
||||||
; scan = strend - (MAX_MATCH-1);
|
|
||||||
|
|
||||||
else ;UNALIGNED_OK
|
|
||||||
|
|
||||||
; if (match[best_len] != scan_end ||
|
; if (match[best_len] != scan_end ||
|
||||||
; match[best_len-1] != scan_end1 ||
|
; match[best_len-1] != scan_end1 ||
|
||||||
; *match != *scan ||
|
; *match != *scan ||
|
||||||
@ -1876,18 +1843,12 @@ else ;UNALIGNED_OK
|
|||||||
; len = MAX_MATCH - (int)(strend - scan);
|
; len = MAX_MATCH - (int)(strend - scan);
|
||||||
; scan = strend - MAX_MATCH;
|
; scan = strend - MAX_MATCH;
|
||||||
|
|
||||||
end if ;UNALIGNED_OK
|
|
||||||
|
|
||||||
; if (len > best_len) {
|
; if (len > best_len) {
|
||||||
; s->match_start = cur_match;
|
; s->match_start = cur_match;
|
||||||
; best_len = len;
|
; best_len = len;
|
||||||
; if (len >= nice_match) break;
|
; if (len >= nice_match) break;
|
||||||
if UNALIGNED_OK eq 1
|
|
||||||
; scan_end = *(uint_16p*)(scan+best_len-1);
|
|
||||||
else
|
|
||||||
; scan_end1 = scan[best_len-1];
|
; scan_end1 = scan[best_len-1];
|
||||||
; scan_end = scan[best_len];
|
; scan_end = scan[best_len];
|
||||||
end if
|
|
||||||
; }
|
; }
|
||||||
; } while ((cur_match = prev[cur_match & wmask]) > limit
|
; } while ((cur_match = prev[cur_match & wmask]) > limit
|
||||||
; && --chain_length != 0);
|
; && --chain_length != 0);
|
||||||
@ -1901,7 +1862,7 @@ else ;FASTEST
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Optimized version for FASTEST only
|
; Optimized version for FASTEST only
|
||||||
mov edx,[s]
|
mov edx,[s]
|
||||||
;zlib_debug 'longest_match'
|
zlib_debug 'longest_match'
|
||||||
|
|
||||||
; The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
; The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
||||||
; It is easy to get rid of this optimization if necessary.
|
; It is easy to get rid of this optimization if necessary.
|
||||||
@ -1909,19 +1870,19 @@ else ;FASTEST
|
|||||||
if MAX_MATCH <> 258
|
if MAX_MATCH <> 258
|
||||||
cmp dword[edx+deflate_state.hash_bits],8
|
cmp dword[edx+deflate_state.hash_bits],8
|
||||||
jge @f
|
jge @f
|
||||||
zlib_debug 'Code too clever' ;Assert(..>=.. && ..==..)
|
zlib_assert 'Code too clever' ;Assert(..>=.. && ..==..)
|
||||||
@@:
|
@@:
|
||||||
end if
|
end if
|
||||||
mov eax,[edx+deflate_state.window_size]
|
mov eax,[edx+deflate_state.window_size]
|
||||||
sub eax,MIN_LOOKAHEAD
|
sub eax,MIN_LOOKAHEAD
|
||||||
cmp [edx+deflate_state.strstart],eax
|
cmp [edx+deflate_state.strstart],eax
|
||||||
jle @f
|
jle @f
|
||||||
zlib_debug 'need lookahead' ;Assert(..<=..)
|
zlib_assert 'need lookahead' ;Assert(..<=..)
|
||||||
@@:
|
@@:
|
||||||
mov eax,[edx+deflate_state.strstart]
|
mov eax,[edx+deflate_state.strstart]
|
||||||
cmp [cur_match],eax
|
cmp [cur_match],eax
|
||||||
jl @f
|
jl @f
|
||||||
zlib_debug 'no future' ;Assert(..<..)
|
zlib_assert 'no future' ;Assert(..<..)
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov esi,[edx+deflate_state.window]
|
mov esi,[edx+deflate_state.window]
|
||||||
@ -1950,7 +1911,7 @@ end if
|
|||||||
mov al,byte[edi]
|
mov al,byte[edi]
|
||||||
cmp al,byte[esi]
|
cmp al,byte[esi]
|
||||||
je @f
|
je @f
|
||||||
zlib_debug 'match[2]?' ;Assert(..==..)
|
zlib_assert 'match[2]?' ;Assert(..==..)
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; We check for insufficient lookahead only every 8th comparison;
|
; We check for insufficient lookahead only every 8th comparison;
|
||||||
@ -1969,7 +1930,7 @@ align 4
|
|||||||
add eax,[edx+deflate_state.window]
|
add eax,[edx+deflate_state.window]
|
||||||
cmp edi,eax
|
cmp edi,eax
|
||||||
jle @f
|
jle @f
|
||||||
zlib_debug 'wild scan' ;Assert(..<=..)
|
zlib_assert 'wild scan' ;Assert(..<=..)
|
||||||
@@:
|
@@:
|
||||||
sub edi,ebx
|
sub edi,ebx
|
||||||
;edi = len
|
;edi = len
|
||||||
@ -1997,9 +1958,9 @@ endp
|
|||||||
; Check that the match at match_start is indeed a match.
|
; Check that the match at match_start is indeed a match.
|
||||||
|
|
||||||
;void (s, start, match, length)
|
;void (s, start, match, length)
|
||||||
; deflate_state *s;
|
; deflate_state *s
|
||||||
; IPos start, match;
|
; IPos start, match
|
||||||
; int length;
|
; int length
|
||||||
align 4
|
align 4
|
||||||
proc check_match, s:dword, start:dword, p3match:dword, length:dword
|
proc check_match, s:dword, start:dword, p3match:dword, length:dword
|
||||||
if DEBUG eq 1
|
if DEBUG eq 1
|
||||||
@ -2042,17 +2003,17 @@ pushad
|
|||||||
;Объем свободного пространства в конце окна.
|
;Объем свободного пространства в конце окна.
|
||||||
;ecx = wsize ;uInt
|
;ecx = wsize ;uInt
|
||||||
;edx = s.strm
|
;edx = s.strm
|
||||||
;zlib_debug 'fill_window'
|
zlib_debug 'fill_window'
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
cmp dword[edi+deflate_state.lookahead],MIN_LOOKAHEAD
|
cmp dword[edi+deflate_state.lookahead],MIN_LOOKAHEAD
|
||||||
jl @f
|
jl @f
|
||||||
zlib_debug 'already enough lookahead' ;Assert(..<..)
|
zlib_assert 'already enough lookahead' ;Assert(..<..)
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
mov ecx,[edi+deflate_state.w_size]
|
mov ecx,[edi+deflate_state.w_size]
|
||||||
mov edx,[edi+deflate_state.strm]
|
mov edx,[edi+deflate_state.strm]
|
||||||
.cycle0: ;do
|
.cycle0: ;do
|
||||||
;zlib_debug 'do'
|
zlib_debug 'do'
|
||||||
mov ebx,[edi+deflate_state.window_size]
|
mov ebx,[edi+deflate_state.window_size]
|
||||||
sub ebx,[edi+deflate_state.lookahead]
|
sub ebx,[edi+deflate_state.lookahead]
|
||||||
sub ebx,[edi+deflate_state.strstart]
|
sub ebx,[edi+deflate_state.strstart]
|
||||||
@ -2135,7 +2096,7 @@ end if
|
|||||||
|
|
||||||
cmp ebx,2
|
cmp ebx,2
|
||||||
jge @f
|
jge @f
|
||||||
zlib_debug 'more < 2' ;Assert(..>=..)
|
zlib_assert 'more < 2' ;Assert(..>=..)
|
||||||
@@:
|
@@:
|
||||||
mov eax,[edi+deflate_state.window]
|
mov eax,[edi+deflate_state.window]
|
||||||
add eax,[edi+deflate_state.strstart]
|
add eax,[edi+deflate_state.strstart]
|
||||||
@ -2260,7 +2221,7 @@ end if
|
|||||||
sub eax,MIN_LOOKAHEAD
|
sub eax,MIN_LOOKAHEAD
|
||||||
cmp [edi+deflate_state.strstart],eax
|
cmp [edi+deflate_state.strstart],eax
|
||||||
jle @f
|
jle @f
|
||||||
zlib_debug 'not enough room for search' ;Assert(..<=..)
|
zlib_assert 'not enough room for search' ;Assert(..<=..)
|
||||||
@@:
|
@@:
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
@ -2317,8 +2278,8 @@ end if
|
|||||||
; window to pending_buf.
|
; window to pending_buf.
|
||||||
|
|
||||||
;block_state (s, flush)
|
;block_state (s, flush)
|
||||||
; deflate_state *s;
|
; deflate_state *s
|
||||||
; int flush;
|
; int flush
|
||||||
align 4
|
align 4
|
||||||
proc deflate_stored uses ebx ecx edi, s:dword, flush:dword
|
proc deflate_stored uses ebx ecx edi, s:dword, flush:dword
|
||||||
; Stored blocks are limited to 0xffff bytes, pending_buf is limited
|
; Stored blocks are limited to 0xffff bytes, pending_buf is limited
|
||||||
@ -2741,7 +2702,7 @@ align 4
|
|||||||
.cycle0end:
|
.cycle0end:
|
||||||
cmp dword[flush],Z_NO_FLUSH
|
cmp dword[flush],Z_NO_FLUSH
|
||||||
jne @f
|
jne @f
|
||||||
zlib_debug 'no flush?' ;Assert (..!=..)
|
zlib_assert 'no flush?' ;Assert (..!=..)
|
||||||
@@:
|
@@:
|
||||||
cmp dword[edi+deflate_state.match_available],0
|
cmp dword[edi+deflate_state.match_available],0
|
||||||
je @f ;if (..)
|
je @f ;if (..)
|
||||||
@ -2780,8 +2741,8 @@ endp
|
|||||||
; deflate switches away from Z_RLE.)
|
; deflate switches away from Z_RLE.)
|
||||||
|
|
||||||
;block_state (s, flush)
|
;block_state (s, flush)
|
||||||
; deflate_state *s;
|
; deflate_state *s
|
||||||
; int flush;
|
; int flush
|
||||||
align 4
|
align 4
|
||||||
proc deflate_rle uses ecx edx edi esi, s:dword, flush:dword
|
proc deflate_rle uses ecx edx edi esi, s:dword, flush:dword
|
||||||
locals
|
locals
|
||||||
@ -2846,7 +2807,7 @@ align 4
|
|||||||
add eax,[edx+deflate_state.window]
|
add eax,[edx+deflate_state.window]
|
||||||
cmp edi,eax
|
cmp edi,eax
|
||||||
jle .end1
|
jle .end1
|
||||||
zlib_debug 'wild scan' ;Assert(..<=..)
|
zlib_assert 'wild scan' ;Assert(..<=..)
|
||||||
.end1:
|
.end1:
|
||||||
|
|
||||||
; Emit match if have run of MIN_MATCH or longer, else emit literal
|
; Emit match if have run of MIN_MATCH or longer, else emit literal
|
||||||
@ -2903,8 +2864,8 @@ endp
|
|||||||
; (It will be regenerated if this run of deflate switches away from Huffman.)
|
; (It will be regenerated if this run of deflate switches away from Huffman.)
|
||||||
|
|
||||||
;block_state (s, flush)
|
;block_state (s, flush)
|
||||||
; deflate_state *s;
|
; deflate_state *s
|
||||||
; int flush;
|
; int flush
|
||||||
align 4
|
align 4
|
||||||
proc deflate_huff uses ebx edi, s:dword, flush:dword
|
proc deflate_huff uses ebx edi, s:dword, flush:dword
|
||||||
locals
|
locals
|
||||||
|
@ -247,8 +247,7 @@ macro put_byte s, c
|
|||||||
}
|
}
|
||||||
macro put_dword s, d
|
macro put_dword s, d
|
||||||
{
|
{
|
||||||
;mov eax,d
|
zlib_debug '(%d)',d
|
||||||
;zlib_debug '(%d)',eax
|
|
||||||
movzx eax,word[s+deflate_state.pending]
|
movzx eax,word[s+deflate_state.pending]
|
||||||
add eax,[s+deflate_state.pending_buf]
|
add eax,[s+deflate_state.pending_buf]
|
||||||
mov dword[eax],d
|
mov dword[eax],d
|
||||||
|
@ -106,9 +106,9 @@ button:
|
|||||||
cmp ah,1
|
cmp ah,1
|
||||||
jne still
|
jne still
|
||||||
|
|
||||||
.exit:
|
.exit: ; ª®¥æ ¯à®£à ¬¬ë
|
||||||
mcall SF_SYS_MISC,SSF_MEM_FREE,[m2]
|
mcall SF_SYS_MISC,SSF_MEM_FREE,[m2]
|
||||||
mcall SF_TERMINATE_PROCESS ; ¨ ç¥ ª®¥æ ¯à®£à ¬¬ë
|
mcall SF_TERMINATE_PROCESS
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
draw_window:
|
draw_window:
|
||||||
@ -164,7 +164,11 @@ test_code:
|
|||||||
mov ecx,[m0size]
|
mov ecx,[m0size]
|
||||||
mov word[eax+z_stream.avail_in],cx ;à §¬¥à ᦨ¬ ¥¬ë¦ ¤ ëå
|
mov word[eax+z_stream.avail_in],cx ;à §¬¥à ᦨ¬ ¥¬ë¦ ¤ ëå
|
||||||
mov [eax+z_stream.next_out],m1 ;ãáâ ¢«¨¢ ¥¬ ¡ãä¥à ¤«ï ᦠâ¨ï
|
mov [eax+z_stream.next_out],m1 ;ãáâ ¢«¨¢ ¥¬ ¡ãä¥à ¤«ï ᦠâ¨ï
|
||||||
mov word[eax+z_stream.avail_out],1024 ;à §¬¥à ¡ãä¥à ¤«ï ᦠâ¨ï
|
mov word[eax+z_stream.avail_out],1024 ;à §¬¥à ¡ãä¥à ¤«ï ᦠâ¨ï (¬ ªá¨¬ã¬ 16 Š¡)
|
||||||
|
|
||||||
|
;¢ëç¨á«ï¥¬ crc ¤«ï ᦨ¬ ¥¬ë¦ ¤ ëå
|
||||||
|
stdcall [calc_crc32], 0,m0,ecx
|
||||||
|
mov edx,eax
|
||||||
|
|
||||||
;call print_z_struct
|
;call print_z_struct
|
||||||
|
|
||||||
@ -172,21 +176,30 @@ test_code:
|
|||||||
|
|
||||||
;call print_z_struct
|
;call print_z_struct
|
||||||
|
|
||||||
;à §¬¥à ᦠâëå ¤ ëå: 1024-word[eax+z_stream.avail_out]
|
;à §¬¥à ᦠâëå ¤ ëå: 1024-word[my_strm.avail_out]
|
||||||
mov eax,my_strm
|
|
||||||
mov ecx,1024
|
mov ecx,1024
|
||||||
sub cx,word[eax+z_stream.avail_out]
|
sub cx,word[my_strm.avail_out]
|
||||||
mov [m1size],ecx
|
mov [m1size],ecx
|
||||||
|
|
||||||
;assert(ret != Z_STREAM_ERROR)
|
;assert(ret != Z_STREAM_ERROR)
|
||||||
;while (strm.avail_out == 0)
|
;while (strm.avail_out == 0)
|
||||||
|
|
||||||
|
;áâ ¢¨¬ crc ᦠâë¥ ¤ ë¥
|
||||||
|
mov ecx,[m1size]
|
||||||
|
sub ecx,4
|
||||||
|
add ecx,m1
|
||||||
|
mov [ecx],edx
|
||||||
|
|
||||||
|
;ä®à¬¨à®¢ ¨¥ ⥪áâ ¤«ï ®â®¡à ¦¥¨ï ᦠâëå ¤ ëå
|
||||||
|
;¢ 16-à¨ç®¬ ¢¨¤¥, 㦮 ⮫쪮 ¤«ï ¯à¨¬¥à
|
||||||
mov ebx,[m1size]
|
mov ebx,[m1size]
|
||||||
mov esi,m1
|
mov esi,m1
|
||||||
mov edi,buf
|
mov edi,buf
|
||||||
mov edx,7
|
mov edx,7
|
||||||
|
align 4
|
||||||
.cycle1: ;rows
|
.cycle1: ;rows
|
||||||
mov ecx,32
|
mov ecx,32
|
||||||
|
align 4
|
||||||
.cycle0: ;cols
|
.cycle0: ;cols
|
||||||
stdcall hex_in_str, edi,[esi],2
|
stdcall hex_in_str, edi,[esi],2
|
||||||
add edi,2
|
add edi,2
|
||||||
@ -199,10 +212,10 @@ test_code:
|
|||||||
mov byte[edi-1],0
|
mov byte[edi-1],0
|
||||||
dec edx
|
dec edx
|
||||||
jnz .cycle1
|
jnz .cycle1
|
||||||
|
|
||||||
.cycle1end:
|
.cycle1end:
|
||||||
mov byte[edi],0
|
mov byte[edi],0
|
||||||
|
|
||||||
|
;㤠«¥¨¥ ¡ãä¥à á à ¥¥ à ᯠª®¢ 묨 ¤ 묨
|
||||||
mcall SF_SYS_MISC,SSF_MEM_FREE,[m2]
|
mcall SF_SYS_MISC,SSF_MEM_FREE,[m2]
|
||||||
|
|
||||||
mov eax,[m1size]
|
mov eax,[m1size]
|
||||||
@ -211,7 +224,7 @@ test_code:
|
|||||||
mov eax,m1
|
mov eax,m1
|
||||||
add eax,2
|
add eax,2
|
||||||
stdcall [deflate_unpack],eax,m2size
|
stdcall [deflate_unpack],eax,m2size
|
||||||
mov [m2],eax
|
mov [m2],eax ;§ ¯¨áì ®¢ëå à ᯠª®¢ ëå ¤ ëå
|
||||||
mov ecx,[m0size] ;;; ???
|
mov ecx,[m0size] ;;; ???
|
||||||
mov [m2size],ecx
|
mov [m2size],ecx
|
||||||
ret
|
ret
|
||||||
@ -243,6 +256,7 @@ import_zlib:
|
|||||||
deflateReset dd sz_deflateReset
|
deflateReset dd sz_deflateReset
|
||||||
deflate dd sz_deflate
|
deflate dd sz_deflate
|
||||||
deflateEnd dd sz_deflateEnd
|
deflateEnd dd sz_deflateEnd
|
||||||
|
calc_crc32 dd sz_calc_crc32
|
||||||
|
|
||||||
dd 0,0
|
dd 0,0
|
||||||
|
|
||||||
@ -252,6 +266,8 @@ import_zlib:
|
|||||||
sz_deflateReset db 'deflateReset',0
|
sz_deflateReset db 'deflateReset',0
|
||||||
sz_deflate db 'deflate',0
|
sz_deflate db 'deflate',0
|
||||||
sz_deflateEnd db 'deflateEnd',0
|
sz_deflateEnd db 'deflateEnd',0
|
||||||
|
sz_calc_crc32 db 'calc_crc32',0
|
||||||
|
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
system_dir_0 db '/sys/lib/'
|
system_dir_0 db '/sys/lib/'
|
||||||
lib_name_0 db 'archiver.obj',0
|
lib_name_0 db 'archiver.obj',0
|
||||||
|
@ -172,7 +172,7 @@ macro put_short s, w
|
|||||||
align 4
|
align 4
|
||||||
proc send_bits uses eax ecx edi, s:dword, value:dword, length:dword
|
proc send_bits uses eax ecx edi, s:dword, value:dword, length:dword
|
||||||
; Tracevv((stderr," l %2d v %4x ", length, value));
|
; Tracevv((stderr," l %2d v %4x ", length, value));
|
||||||
;zlib_debug 'send_bits value = %d',[value]
|
zlib_debug 'send_bits value = %d',[value]
|
||||||
;if DEBUG eq 1
|
;if DEBUG eq 1
|
||||||
mov eax,[length]
|
mov eax,[length]
|
||||||
cmp eax,0
|
cmp eax,0
|
||||||
@ -180,7 +180,7 @@ proc send_bits uses eax ecx edi, s:dword, value:dword, length:dword
|
|||||||
cmp eax,15
|
cmp eax,15
|
||||||
jle .end1
|
jle .end1
|
||||||
@@:
|
@@:
|
||||||
zlib_debug 'invalid length' ;Assert(..>0 && ..<=15)
|
zlib_assert 'invalid length' ;Assert(..>0 && ..<=15)
|
||||||
.end1:
|
.end1:
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
add [edi+deflate_state.bits_sent],eax
|
add [edi+deflate_state.bits_sent],eax
|
||||||
@ -390,7 +390,7 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc _tr_init uses eax edi, s:dword
|
proc _tr_init uses eax edi, s:dword
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug '_tr_init'
|
zlib_debug '_tr_init'
|
||||||
call tr_static_init
|
call tr_static_init
|
||||||
|
|
||||||
mov eax,edi
|
mov eax,edi
|
||||||
@ -530,7 +530,7 @@ endl
|
|||||||
pushad
|
pushad
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
mov eax,[k]
|
mov eax,[k]
|
||||||
;zlib_debug 'pqdownheap k = %d',eax
|
zlib_debug 'pqdownheap k = %d',eax
|
||||||
mov esi,eax
|
mov esi,eax
|
||||||
shl esi,1
|
shl esi,1
|
||||||
mov ax,[edi+deflate_state.heap+2*eax]
|
mov ax,[edi+deflate_state.heap+2*eax]
|
||||||
@ -604,7 +604,7 @@ locals
|
|||||||
overflow dd 0 ;int ;number of elements with bit length too large
|
overflow dd 0 ;int ;number of elements with bit length too large
|
||||||
endl
|
endl
|
||||||
pushad
|
pushad
|
||||||
;zlib_debug 'gen_bitlen'
|
zlib_debug 'gen_bitlen'
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
mov edx,[desc]
|
mov edx,[desc]
|
||||||
mov eax,[edx+tree_desc.dyn_tree]
|
mov eax,[edx+tree_desc.dyn_tree]
|
||||||
@ -817,7 +817,7 @@ locals
|
|||||||
endl
|
endl
|
||||||
; The distribution counts are first used to generate the code values
|
; The distribution counts are first used to generate the code values
|
||||||
; without bit reversal.
|
; without bit reversal.
|
||||||
;zlib_debug 'gen_codes'
|
zlib_debug 'gen_codes'
|
||||||
mov ebx,ebp
|
mov ebx,ebp
|
||||||
sub ebx,2*(MAX_BITS+1)
|
sub ebx,2*(MAX_BITS+1)
|
||||||
|
|
||||||
@ -846,7 +846,7 @@ endl
|
|||||||
dec ax
|
dec ax
|
||||||
cmp ax,(1 shl MAX_BITS)-1
|
cmp ax,(1 shl MAX_BITS)-1
|
||||||
je @f
|
je @f
|
||||||
zlib_debug 'inconsistent bit counts' ;Assert(..==..)
|
zlib_assert 'inconsistent bit counts' ;Assert(..==..)
|
||||||
@@:
|
@@:
|
||||||
; Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
; Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
||||||
|
|
||||||
@ -910,7 +910,7 @@ endl
|
|||||||
mov ecx,[ecx+static_tree_desc.elems]
|
mov ecx,[ecx+static_tree_desc.elems]
|
||||||
mov [elems],ecx
|
mov [elems],ecx
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug 'build_tree cycle0 ecx = %d',ecx
|
zlib_debug 'build_tree cycle0 ecx = %d',ecx
|
||||||
|
|
||||||
mov dword[edi+deflate_state.heap_len],0
|
mov dword[edi+deflate_state.heap_len],0
|
||||||
mov dword[edi+deflate_state.heap_max],HEAP_SIZE
|
mov dword[edi+deflate_state.heap_max],HEAP_SIZE
|
||||||
@ -1103,7 +1103,7 @@ locals
|
|||||||
min_count dd 4 ;int ;min repeat count
|
min_count dd 4 ;int ;min repeat count
|
||||||
endl
|
endl
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug 'scan_tree'
|
zlib_debug 'scan_tree'
|
||||||
mov eax,[tree]
|
mov eax,[tree]
|
||||||
movzx eax,word[eax+Len]
|
movzx eax,word[eax+Len]
|
||||||
mov [nextlen],eax
|
mov [nextlen],eax
|
||||||
@ -1227,7 +1227,7 @@ locals
|
|||||||
min_count dd 4 ;int ;min repeat count
|
min_count dd 4 ;int ;min repeat count
|
||||||
endl
|
endl
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug 'send_tree'
|
zlib_debug 'send_tree'
|
||||||
; *** tree[max_code+1].Len = -1 ;guard already set
|
; *** tree[max_code+1].Len = -1 ;guard already set
|
||||||
mov eax,[tree]
|
mov eax,[tree]
|
||||||
movzx eax,word[eax+Len]
|
movzx eax,word[eax+Len]
|
||||||
@ -1287,7 +1287,7 @@ align 4
|
|||||||
cmp dword[count],6
|
cmp dword[count],6
|
||||||
jle .end8
|
jle .end8
|
||||||
@@:
|
@@:
|
||||||
zlib_debug ' 3_6?' ;Assert(..>=.. && ..<=..)
|
zlib_assert ' 3_6?' ;Assert(..>=.. && ..<=..)
|
||||||
.end8:
|
.end8:
|
||||||
mov ebx,edi
|
mov ebx,edi
|
||||||
add ebx,deflate_state.bl_tree
|
add ebx,deflate_state.bl_tree
|
||||||
@ -1410,7 +1410,7 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc send_all_trees uses eax ebx ecx edi, s:dword, lcodes:dword, dcodes:dword, blcodes:dword
|
proc send_all_trees uses eax ebx ecx edi, s:dword, lcodes:dword, dcodes:dword, blcodes:dword
|
||||||
;ecx = index in bl_order
|
;ecx = index in bl_order
|
||||||
;zlib_debug 'send_all_trees'
|
zlib_debug 'send_all_trees'
|
||||||
cmp dword[lcodes],257
|
cmp dword[lcodes],257
|
||||||
jl @f
|
jl @f
|
||||||
cmp dword[dcodes],1
|
cmp dword[dcodes],1
|
||||||
@ -1418,7 +1418,7 @@ proc send_all_trees uses eax ebx ecx edi, s:dword, lcodes:dword, dcodes:dword, b
|
|||||||
cmp dword[blcodes],4
|
cmp dword[blcodes],4
|
||||||
jge .end0
|
jge .end0
|
||||||
@@:
|
@@:
|
||||||
zlib_debug 'not enough codes' ;Assert(..>=.. && ..>=.. && ..>=..)
|
zlib_assert 'not enough codes' ;Assert(..>=.. && ..>=.. && ..>=..)
|
||||||
.end0:
|
.end0:
|
||||||
cmp dword[lcodes],L_CODES
|
cmp dword[lcodes],L_CODES
|
||||||
jg @f
|
jg @f
|
||||||
@ -1427,7 +1427,7 @@ proc send_all_trees uses eax ebx ecx edi, s:dword, lcodes:dword, dcodes:dword, b
|
|||||||
cmp dword[blcodes],BL_CODES
|
cmp dword[blcodes],BL_CODES
|
||||||
jle .end1
|
jle .end1
|
||||||
@@:
|
@@:
|
||||||
zlib_debug 'too many codes' ;Assert(..<=.. && ..<=.. && ..<=..)
|
zlib_assert 'too many codes' ;Assert(..<=.. && ..<=.. && ..<=..)
|
||||||
.end1:
|
.end1:
|
||||||
; Tracev((stderr, "\nbl counts: "));
|
; Tracev((stderr, "\nbl counts: "));
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
@ -1549,7 +1549,7 @@ locals
|
|||||||
endl
|
endl
|
||||||
; Build the Huffman trees unless a stored block is forced
|
; Build the Huffman trees unless a stored block is forced
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug '_tr_flush_block'
|
zlib_debug '_tr_flush_block'
|
||||||
cmp word[edi+deflate_state.level],0
|
cmp word[edi+deflate_state.level],0
|
||||||
jle .end0 ;if (..>0)
|
jle .end0 ;if (..>0)
|
||||||
|
|
||||||
@ -1601,7 +1601,7 @@ endl
|
|||||||
.end0: ;else
|
.end0: ;else
|
||||||
cmp dword[buf],0
|
cmp dword[buf],0
|
||||||
jne @f
|
jne @f
|
||||||
zlib_debug 'lost buf' ;Assert(..!=0)
|
zlib_assert 'lost buf' ;Assert(..!=0)
|
||||||
@@:
|
@@:
|
||||||
mov eax,[stored_len]
|
mov eax,[stored_len]
|
||||||
add eax,5
|
add eax,5
|
||||||
@ -1705,7 +1705,7 @@ endp
|
|||||||
align 4
|
align 4
|
||||||
proc _tr_tally uses ebx edi, s:dword, dist:dword, lc:dword
|
proc _tr_tally uses ebx edi, s:dword, dist:dword, lc:dword
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug '_tr_tally'
|
zlib_debug '_tr_tally'
|
||||||
mov eax,[edi+deflate_state.last_lit]
|
mov eax,[edi+deflate_state.last_lit]
|
||||||
shl eax,1
|
shl eax,1
|
||||||
add eax,[edi+deflate_state.d_buf]
|
add eax,[edi+deflate_state.d_buf]
|
||||||
@ -1737,7 +1737,7 @@ proc _tr_tally uses ebx edi, s:dword, dist:dword, lc:dword
|
|||||||
cmp ax,D_CODES
|
cmp ax,D_CODES
|
||||||
jl .end2
|
jl .end2
|
||||||
@@:
|
@@:
|
||||||
zlib_debug '_tr_tally: bad match' ;Assert(..<.. && ..<=.. && ..<..)
|
zlib_assert '_tr_tally: bad match' ;Assert(..<.. && ..<=.. && ..<..)
|
||||||
.end2:
|
.end2:
|
||||||
mov eax,[lc]
|
mov eax,[lc]
|
||||||
add eax,_length_code
|
add eax,_length_code
|
||||||
@ -1853,7 +1853,7 @@ endl
|
|||||||
mov [u_code],eax
|
mov [u_code],eax
|
||||||
cmp eax,D_CODES
|
cmp eax,D_CODES
|
||||||
jl @f
|
jl @f
|
||||||
zlib_debug 'bad d_code' ;Assert(..<..)
|
zlib_assert 'bad d_code' ;Assert(..<..)
|
||||||
@@:
|
@@:
|
||||||
send_code edi, [u_code], [dtree] ;send the distance code
|
send_code edi, [u_code], [dtree] ;send the distance code
|
||||||
mov eax,[u_code]
|
mov eax,[u_code]
|
||||||
@ -1877,7 +1877,7 @@ endl
|
|||||||
add eax,[edi+deflate_state.lit_bufsize]
|
add eax,[edi+deflate_state.lit_bufsize]
|
||||||
cmp word[edi+deflate_state.pending],ax
|
cmp word[edi+deflate_state.pending],ax
|
||||||
jl @f
|
jl @f
|
||||||
zlib_debug 'pendingBuf overflow' ;Assert(..<..)
|
zlib_assert 'pendingBuf overflow' ;Assert(..<..)
|
||||||
@@:
|
@@:
|
||||||
mov eax,[edi+deflate_state.last_lit]
|
mov eax,[edi+deflate_state.last_lit]
|
||||||
cmp [lx],eax
|
cmp [lx],eax
|
||||||
@ -1911,10 +1911,9 @@ proc detect_data_type uses ebx ecx edi, s:dword
|
|||||||
; 0xf3ffc07f = binary 11110011111111111100000001111111
|
; 0xf3ffc07f = binary 11110011111111111100000001111111
|
||||||
locals
|
locals
|
||||||
black_mask dd 0xf3ffc07f
|
black_mask dd 0xf3ffc07f
|
||||||
; int n;
|
|
||||||
endl
|
endl
|
||||||
mov edi,[s]
|
mov edi,[s]
|
||||||
;zlib_debug 'detect_data_type'
|
zlib_debug 'detect_data_type'
|
||||||
|
|
||||||
; Check for non-textual ("black-listed") bytes.
|
; Check for non-textual ("black-listed") bytes.
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
@ -1985,7 +1984,7 @@ endp
|
|||||||
; int len ;its bit length
|
; int len ;its bit length
|
||||||
align 4
|
align 4
|
||||||
proc bi_reverse uses ebx, p1code:dword, len:dword
|
proc bi_reverse uses ebx, p1code:dword, len:dword
|
||||||
;zlib_debug 'bi_reverse'
|
zlib_debug 'bi_reverse'
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
@@: ;do
|
@@: ;do
|
||||||
mov ebx,[p1code]
|
mov ebx,[p1code]
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
; Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
; Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||||
; than 64k bytes at a time (needed on systems with 16-bit int).
|
; than 64k bytes at a time (needed on systems with 16-bit int).
|
||||||
|
|
||||||
;if MSDOS
|
|
||||||
;# define UNALIGNED_OK
|
|
||||||
;end if
|
|
||||||
|
|
||||||
; Maximum value for memLevel in deflateInit2
|
; Maximum value for memLevel in deflateInit2
|
||||||
MAX_MEM_LEVEL equ 9
|
MAX_MEM_LEVEL equ 9
|
||||||
|
|
||||||
@ -30,136 +26,3 @@ MAX_WBITS equ 15 ;32K LZ77 window
|
|||||||
; The memory requirements for inflate are (in bytes) 1 << windowBits
|
; The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||||
; that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
; that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||||
; for small objects.
|
; for small objects.
|
||||||
|
|
||||||
; /* Type declarations */
|
|
||||||
|
|
||||||
;#ifndef OF /* function prototypes */
|
|
||||||
;# ifdef STDC
|
|
||||||
;# define OF(args) args
|
|
||||||
;# else
|
|
||||||
;# define OF(args) ()
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#ifndef Z_ARG /* function prototypes for stdarg */
|
|
||||||
;# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
|
||||||
;# define Z_ARG(args) args
|
|
||||||
;# else
|
|
||||||
;# define Z_ARG(args) ()
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
; The following definitions for FAR are needed only for MSDOS mixed
|
|
||||||
; model programming (small or medium model with some far allocations).
|
|
||||||
; This was tested only with MSC; for other MSDOS compilers you may have
|
|
||||||
; to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
|
||||||
; just define FAR to be empty.
|
|
||||||
|
|
||||||
;#if defined(WINDOWS) || defined(WIN32)
|
|
||||||
; If building or using zlib as a DLL, define ZLIB_DLL.
|
|
||||||
; This is not mandatory, but it offers a little performance increase.
|
|
||||||
|
|
||||||
;# ifdef ZLIB_DLL
|
|
||||||
;# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
|
||||||
;# ifdef ZLIB_INTERNAL
|
|
||||||
;# define ZEXTERN extern __declspec(dllexport)
|
|
||||||
;# else
|
|
||||||
;# define ZEXTERN extern __declspec(dllimport)
|
|
||||||
;# endif
|
|
||||||
;# endif
|
|
||||||
;# endif /* ZLIB_DLL */
|
|
||||||
; If building or using zlib with the WINAPI/WINAPIV calling convention,
|
|
||||||
; define ZLIB_WINAPI.
|
|
||||||
; Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
|
||||||
|
|
||||||
;#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
|
||||||
;# include <limits.h>
|
|
||||||
;# if (UINT_MAX == 0xffffffffUL)
|
|
||||||
;# define Z_U4 unsigned
|
|
||||||
;# elif (ULONG_MAX == 0xffffffffUL)
|
|
||||||
;# define Z_U4 unsigned long
|
|
||||||
;# elif (USHRT_MAX == 0xffffffffUL)
|
|
||||||
;# define Z_U4 unsigned short
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;if Z_U4
|
|
||||||
; typedef Z_U4 z_crc_t;
|
|
||||||
;else
|
|
||||||
; typedef unsigned long z_crc_t;
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;if HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
|
||||||
;# define Z_HAVE_UNISTD_H
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;if HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
|
||||||
;# define Z_HAVE_STDARG_H
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;if STDC
|
|
||||||
;# ifndef Z_SOLO
|
|
||||||
;# include <sys/types.h> /* for off_t */
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
|
||||||
;# ifndef Z_SOLO
|
|
||||||
;# include <stdarg.h> /* for va_list */
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
; a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
|
||||||
; "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
|
||||||
; though the former does not conform to the LFS document), but considering
|
|
||||||
; both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
|
||||||
; equivalently requesting no 64-bit operations
|
|
||||||
|
|
||||||
;#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
|
|
||||||
;# undef _LARGEFILE64_SOURCE
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
|
|
||||||
;# define Z_HAVE_UNISTD_H
|
|
||||||
;end if
|
|
||||||
;#ifndef Z_SOLO
|
|
||||||
;# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
|
|
||||||
;# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
|
|
||||||
;# ifdef VMS
|
|
||||||
;# include <unixio.h> /* for off_t */
|
|
||||||
;# endif
|
|
||||||
;# ifndef z_off_t
|
|
||||||
;# define z_off_t off_t
|
|
||||||
;# endif
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
|
|
||||||
;# define Z_LFS64
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
|
|
||||||
;# define Z_LARGE64
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
|
|
||||||
;# define Z_WANT64
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;#if !defined(SEEK_SET) && !defined(Z_SOLO)
|
|
||||||
;# define SEEK_SET 0 /* Seek from beginning of file. */
|
|
||||||
;# define SEEK_CUR 1 /* Seek from current position. */
|
|
||||||
;# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
|
||||||
;end if
|
|
||||||
|
|
||||||
;# define z_off_t long
|
|
||||||
|
|
||||||
;#if !defined(_WIN32) && defined(Z_LARGE64)
|
|
||||||
;# define z_off64_t off64_t
|
|
||||||
;else
|
|
||||||
;# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
|
||||||
;# define z_off64_t __int64
|
|
||||||
;# else
|
|
||||||
;# define z_off64_t z_off_t
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
@ -11,6 +11,7 @@ FASTEST equ 1
|
|||||||
GEN_TREES_H equ 0
|
GEN_TREES_H equ 0
|
||||||
DEBUG equ 0
|
DEBUG equ 0
|
||||||
DYNAMIC_CRC_TABLE equ 1
|
DYNAMIC_CRC_TABLE equ 1
|
||||||
|
Z_SOLO equ 0
|
||||||
|
|
||||||
; define NO_GZIP when compiling if you want to disable gzip header and
|
; define NO_GZIP when compiling if you want to disable gzip header and
|
||||||
; trailer creation by deflate(). NO_GZIP would be used to avoid linking in
|
; trailer creation by deflate(). NO_GZIP would be used to avoid linking in
|
||||||
@ -20,12 +21,19 @@ GZIP equ 1
|
|||||||
|
|
||||||
macro zlib_debug fmt,p1
|
macro zlib_debug fmt,p1
|
||||||
{
|
{
|
||||||
local .end_t
|
if DEBUG eq 1
|
||||||
local .m_fmt
|
zlib_assert fmt,p1
|
||||||
jmp .end_t
|
end if
|
||||||
|
}
|
||||||
|
|
||||||
|
macro zlib_assert fmt,p1
|
||||||
|
{
|
||||||
|
local .end_t
|
||||||
|
local .m_fmt
|
||||||
|
jmp .end_t
|
||||||
.m_fmt db fmt,13,10,0
|
.m_fmt db fmt,13,10,0
|
||||||
align 4
|
align 4
|
||||||
.end_t:
|
.end_t:
|
||||||
if p1 eq
|
if p1 eq
|
||||||
stdcall dbg_print,0,.m_fmt
|
stdcall dbg_print,0,.m_fmt
|
||||||
else
|
else
|
||||||
@ -36,6 +44,7 @@ end if
|
|||||||
include 'zlib.inc'
|
include 'zlib.inc'
|
||||||
include 'deflate.inc'
|
include 'deflate.inc'
|
||||||
include 'zutil.asm'
|
include 'zutil.asm'
|
||||||
|
include '../kfar_arc/crc.inc'
|
||||||
include 'crc32.asm'
|
include 'crc32.asm'
|
||||||
include 'adler32.asm'
|
include 'adler32.asm'
|
||||||
include 'trees.asm'
|
include 'trees.asm'
|
||||||
@ -169,6 +178,9 @@ EXPORTS:
|
|||||||
dd adeflateReset, deflateReset
|
dd adeflateReset, deflateReset
|
||||||
dd adeflate, deflate
|
dd adeflate, deflate
|
||||||
dd adeflateEnd, deflateEnd
|
dd adeflateEnd, deflateEnd
|
||||||
|
dd adeflateCopy, deflateCopy
|
||||||
|
dd azError, zError
|
||||||
|
dd acalc_crc32, calc_crc32
|
||||||
dd 0
|
dd 0
|
||||||
|
|
||||||
; exported names
|
; exported names
|
||||||
@ -176,4 +188,7 @@ adeflateInit db 'deflateInit',0
|
|||||||
adeflateInit2 db 'deflateInit2',0
|
adeflateInit2 db 'deflateInit2',0
|
||||||
adeflateReset db 'deflateReset',0
|
adeflateReset db 'deflateReset',0
|
||||||
adeflate db 'deflate',0
|
adeflate db 'deflate',0
|
||||||
adeflateEnd db 'deflateEnd',0
|
adeflateEnd db 'deflateEnd',0
|
||||||
|
adeflateCopy db 'deflateCopy',0
|
||||||
|
azError db 'zError',0
|
||||||
|
acalc_crc32 db 'calc_crc32',0
|
||||||
|
@ -212,7 +212,7 @@ zlib_version equ zlibVersion
|
|||||||
; inflateBackInit_((strm), (windowBits), (window), \
|
; inflateBackInit_((strm), (windowBits), (window), \
|
||||||
; ZLIB_VERSION, (int)sizeof(z_stream))
|
; ZLIB_VERSION, (int)sizeof(z_stream))
|
||||||
|
|
||||||
;#ifndef Z_SOLO
|
if Z_SOLO eq 0
|
||||||
|
|
||||||
; gzgetc() macro and its supporting function and exposed data structure. Note
|
; gzgetc() macro and its supporting function and exposed data structure. Note
|
||||||
; that the real internal state is much larger than the exposed structure.
|
; that the real internal state is much larger than the exposed structure.
|
||||||
@ -234,7 +234,7 @@ zlib_version equ zlibVersion
|
|||||||
;#else
|
;#else
|
||||||
;# define gzgetc(g) \
|
;# define gzgetc(g) \
|
||||||
; ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
|
; ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g))
|
||||||
;end if
|
end if
|
||||||
|
|
||||||
; provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
|
; provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
|
||||||
; change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
|
; change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
|
||||||
@ -252,11 +252,4 @@ zlib_version equ zlibVersion
|
|||||||
;gzFile gzopen_w OF((const wchar_t *path,
|
;gzFile gzopen_w OF((const wchar_t *path,
|
||||||
; const char *mode));
|
; const char *mode));
|
||||||
;end if
|
;end if
|
||||||
;#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
|
||||||
;# ifndef Z_SOLO
|
|
||||||
;int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
|
|
||||||
; const char *format,
|
|
||||||
; va_list va));
|
|
||||||
;# endif
|
|
||||||
;end if
|
|
||||||
|
|
||||||
|
@ -107,38 +107,33 @@ end if
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;if DEBUG
|
|
||||||
|
|
||||||
;# define verbose 0
|
|
||||||
;int z_verbose = verbose;
|
|
||||||
|
|
||||||
;void (m)
|
;void (m)
|
||||||
; char *m;
|
; char *m
|
||||||
align 4
|
align 4
|
||||||
proc z_error, m:dword
|
proc z_error, m:dword
|
||||||
; fprintf(stderr, "%s\n", m);
|
; fprintf(stderr, "%s\n", m);
|
||||||
; exit(1);
|
; exit(1);
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
;end if
|
|
||||||
|
|
||||||
; exported to allow conversion of error code to string for compress() and
|
; exported to allow conversion of error code to string for compress() and
|
||||||
; uncompress()
|
; uncompress()
|
||||||
|
|
||||||
;const char * (err)
|
;const char * (err)
|
||||||
; int err;
|
; int err
|
||||||
align 4
|
align 4
|
||||||
proc zError, err:dword
|
proc zError uses ecx, err:dword
|
||||||
; return ERR_MSG(err);
|
ERR_MSG [err]
|
||||||
|
mov eax,ecx
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;#ifndef HAVE_MEMCPY
|
;#ifndef HAVE_MEMCPY
|
||||||
|
|
||||||
;void (dest, source, len)
|
;void (dest, source, len)
|
||||||
; Bytef* dest;
|
; Bytef* dest
|
||||||
; const Bytef* source;
|
; const Bytef* source
|
||||||
; uInt len;
|
; uInt len
|
||||||
align 4
|
align 4
|
||||||
proc zmemcpy uses ecx edi esi, dest:dword, source:dword, len:dword
|
proc zmemcpy uses ecx edi esi, dest:dword, source:dword, len:dword
|
||||||
mov ecx,[len]
|
mov ecx,[len]
|
||||||
@ -155,9 +150,9 @@ zlib_debug 'zmemcpy size = %d',ecx
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;int (s1, s2, len)
|
;int (s1, s2, len)
|
||||||
; const Bytef* s1;
|
; const Bytef* s1
|
||||||
; const Bytef* s2;
|
; const Bytef* s2
|
||||||
; uInt len;
|
; uInt len
|
||||||
align 4
|
align 4
|
||||||
proc zmemcmp, s1:dword, s2:dword, len:dword
|
proc zmemcmp, s1:dword, s2:dword, len:dword
|
||||||
; uInt j;
|
; uInt j;
|
||||||
@ -170,8 +165,8 @@ proc zmemcmp, s1:dword, s2:dword, len:dword
|
|||||||
endp
|
endp
|
||||||
|
|
||||||
;void (dest, len)
|
;void (dest, len)
|
||||||
; Bytef* dest;
|
; Bytef* dest
|
||||||
; uInt len;
|
; uInt len
|
||||||
align 4
|
align 4
|
||||||
proc zmemzero, dest:dword, len:dword
|
proc zmemzero, dest:dword, len:dword
|
||||||
; if (len == 0) return;
|
; if (len == 0) return;
|
||||||
@ -182,8 +177,6 @@ proc zmemzero, dest:dword, len:dword
|
|||||||
endp
|
endp
|
||||||
;end if
|
;end if
|
||||||
|
|
||||||
;#ifndef Z_SOLO
|
|
||||||
|
|
||||||
;voidpf (voidpf opaque, unsigned items, unsigned size)
|
;voidpf (voidpf opaque, unsigned items, unsigned size)
|
||||||
align 4
|
align 4
|
||||||
proc zcalloc uses ebx ecx, opaque:dword, items:dword, size:dword
|
proc zcalloc uses ebx ecx, opaque:dword, items:dword, size:dword
|
||||||
@ -200,4 +193,3 @@ proc zcfree uses eax ebx ecx, opaque:dword, p2ptr:dword
|
|||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;end if /* !Z_SOLO */
|
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
|
|
||||||
macro ERR_MSG err
|
macro ERR_MSG err
|
||||||
{
|
{
|
||||||
mov ecx,Z_NEED_DICT-err
|
mov ecx,Z_NEED_DICT
|
||||||
|
sub ecx,err
|
||||||
mov ecx,[4*ecx+z_errmsg]
|
mov ecx,[4*ecx+z_errmsg]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user