Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6799 → Rev 6797

/programs/fs/kfar/trunk/zlib/deflate.asm
162,9 → 162,8
push ebx
mov ebx,[s+deflate_state.w_mask]
and ebx,str
shl ebx,2
add ebx,[s+deflate_state.prev]
mov [ebx],eax
mov byte[ebx],al
pop ebx
end if
mov eax,[s+deflate_state.ins_h]
180,13 → 179,13
 
macro CLEAR_HASH s
{
;mov eax,[s+deflate_state.hash_size]
;dec eax
;shl eax,2
;add eax,[s+deflate_state.head]
;mov dword[eax],NIL
mov eax,[s+deflate_state.hash_size]
;dec eax
dec eax
shl eax,2
add eax,[s+deflate_state.head]
mov dword[eax],NIL
mov eax,[s+deflate_state.hash_size]
dec eax
shl eax,2 ;sizeof(*s.head)
stdcall zmemzero, [s+deflate_state.head], eax
}
588,6 → 587,7
end if
mov dword[ebx+z_stream.adler],eax
mov dword[edi+deflate_state.last_flush],Z_NO_FLUSH
 
stdcall _tr_init, edi
 
mov eax,Z_OK
1925,8 → 1925,6
sub ecx,edi
jz @f
repe cmpsb
dec edi
dec esi
@@:
 
mov eax,[edx+deflate_state.window_size]
1970,7 → 1968,6
dec dword[chain_length]
cmp dword[chain_length],0
jne .cycle0
align 4
.cycle0end: ;while (..>.. && ..!=0)
 
mov eax,[edx+deflate_state.lookahead]
2284,7 → 2281,6
jge .cycle0end
cmp dword[edx+z_stream.avail_in],0
jne .cycle0
align 4
.cycle0end: ;while (..<.. && ..!=..)
 
; If the WIN_INIT bytes after the end of the current data have never been
2415,12 → 2411,12
mov eax,[edi+deflate_state.pending_buf_size]
sub eax,5
cmp ecx,eax
jle .cycle0 ;if (..>..)
jle @f ;if (..>..)
mov ecx,eax
@@:
;ecx = max_block_size
 
; Copy as much as possible from input to output:
align 4
.cycle0: ;for (;;) {
; Fill the window as much as possible:
cmp dword[edi+deflate_state.lookahead],1
2439,10 → 2435,7
cmp dword[edi+deflate_state.lookahead],0
je .cycle0end ;if (..==0) break ;flush the current block
.end0:
cmp dword[edi+deflate_state.block_start],0
jge @f
zlib_assert 'block gone' ;Assert(..>=0)
@@:
; Assert(s->block_start >= 0, "block gone");
 
mov eax,[edi+deflate_state.lookahead]
add [edi+deflate_state.strstart],eax
2830,7 → 2823,6
dec dword[edi+deflate_state.lookahead]
;.end4:
jmp .cycle0
align 4
.cycle0end:
cmp dword[flush],Z_NO_FLUSH
jne @f
/programs/fs/kfar/trunk/zlib/deflate.inc
46,7 → 46,7
; Stream status
 
; Data structure describing a single value and its code string.
struct ct_data
struct ct_data ;ct_data_s
fc dw ? ;union
;uint_16 freq ;frequency count
;uint_16 code ;bit string
60,7 → 60,7
Dad equ ct_data.dale ;.dad
Len equ ct_data.dale ;.len
 
struct tree_desc
struct tree_desc ;tree_desc_s
dyn_tree dd ? ;ct_data * ;the dynamic tree
max_code dd ? ;int ;largest code with non zero frequency
stat_desc dd ? ;static_tree_desc * ;the corresponding static tree
80,7 → 80,6
gzhead dd ? ;gz_headerp ;gzip header information to write
gzindex dd ? ;uInt ;where in extra, name, or comment
method db ? ;Byte ;can only be DEFLATED
rb 3 ;for align
last_flush dd ? ;int ;value of flush param for previous deflate call
 
; used by deflate.asm:
172,7 → 171,7
; The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
; The same heap array is used to build all trees.
 
depth rb ((2*L_CODES+1)+3) and (not 3) ;uch[]
depth rb 2*L_CODES+1 ;uch[]
; Depth of each subtree used as tie breaker for trees of equal frequency
 
l_buf dd ? ;uchf * ;buffer for literals or lengths
238,6 → 237,9
 
macro put_byte s, c
{
;xor eax,eax
;mov al,c
;zlib_debug '(%d)',eax
movzx eax,word[s+deflate_state.pending]
add eax,[s+deflate_state.pending_buf]
mov byte[eax],c
/programs/fs/kfar/trunk/zlib/trees.asm
386,7 → 386,7
; Initialize the tree data structures for a new zlib stream.
 
;void (s)
; deflate_state* s
; deflate_state* s;
align 4
proc _tr_init uses eax edi, s:dword
mov edi,[s]
425,6 → 425,7
; deflate_state* s
align 4
proc init_block uses eax ecx edi, s:dword
; int n ;iterates over tree elements
mov edi,[s]
 
; Initialize the trees.
450,7 → 451,8
add eax,sizeof.ct_data
loop @b
 
mov word[edi+sizeof.ct_data*END_BLOCK+deflate_state.dyn_ltree+Freq],1
mov ecx,sizeof.ct_data*END_BLOCK+deflate_state.dyn_ltree+Freq
mov word[ecx+edi],1
mov dword[edi+deflate_state.static_len],0
mov dword[edi+deflate_state.opt_len],0
mov dword[edi+deflate_state.matches],0
1355,11 → 1357,13
mov eax,edi
add eax,deflate_state.dyn_ltree
stdcall scan_tree, edi, eax, [edi+deflate_state.l_desc.max_code]
add eax,deflate_state.dyn_dtree-deflate_state.dyn_ltree
mov eax,edi
add eax,deflate_state.dyn_dtree
stdcall scan_tree, edi, eax, [edi+deflate_state.d_desc.max_code]
 
; Build the bit length tree:
add eax,deflate_state.bl_desc-deflate_state.dyn_dtree
mov eax,edi
add eax,deflate_state.bl_desc
stdcall build_tree, edi, eax
; opt_len now includes the length of the tree representations, except
; the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
1502,7 → 1506,7
; Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
 
;void (s)
; deflate_state* s
; deflate_state* s;
align 4
proc _tr_flush_bits, s:dword
stdcall bi_flush, [s]
1741,11 → 1745,13
add eax,LITERALS+1
imul eax,sizeof.ct_data
add eax,edi
inc word[eax+deflate_state.dyn_ltree+Freq]
add eax,deflate_state.dyn_ltree+Freq
inc word[eax]
d_code [dist]
imul eax,sizeof.ct_data
add eax,edi
inc word[eax+deflate_state.dyn_dtree+Freq]
add eax,deflate_state.dyn_dtree+Freq
inc word[eax]
.end0:
 
if TRUNCATE_BLOCK eq 1
1789,7 → 1795,7
; Send the block data compressed using the given Huffman trees
 
;void (s, ltree, dtree)
; deflate_state* s
; deflate_state* s;
; ct_data *ltree ;literal tree
; ct_data *dtree ;distance tree
align 4
1946,7 → 1952,7
.end0:
mov ecx,32
mov ebx,edi
add ebx,deflate_state.dyn_ltree+Freq+32*sizeof.ct_data
add ebx,deflate_state.dyn_ltree+Freq
.cycle1:
cmp ecx,LITERALS
jge .cycle1end ;for (..;..<..;..,..)
/programs/fs/kfar/trunk/zlib/zlib.asm
3,7 → 3,7
include '../../../../macros.inc'
include '../../../../KOSfuncs.inc'
 
FASTEST equ 0
FASTEST equ 1
GEN_TREES_H equ 0
DEBUG equ 0
DYNAMIC_CRC_TABLE equ 1