various fixes

git-svn-id: svn://kolibrios.org@6813 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-12-24 11:48:45 +00:00
parent 274dc2fb2c
commit 0665c95c1b

View File

@ -732,6 +732,7 @@ align 4
dec dword[bits] dec dword[bits]
sub eax,2 sub eax,2
jmp @b jmp @b
align 4
@@: @@:
dec word[eax] ;move one leaf down the tree dec word[eax] ;move one leaf down the tree
add word[eax+2],2 ;move one overflow item as its brother add word[eax+2],2 ;move one overflow item as its brother
@ -765,10 +766,7 @@ align 4
movzx eax,word[edi+deflate_state.heap+2*eax] movzx eax,word[edi+deflate_state.heap+2*eax]
mov [m],eax ;m = s.heap[--h] mov [m],eax ;m = s.heap[--h]
cmp eax,[max_code] cmp eax,[max_code]
jle @f ;if (..>..) continue jg .cycle4 ;if (..>..) continue
dec ecx
jmp .cycle4
@@:
mov esi,[m] mov esi,[m]
imul esi,sizeof.ct_data imul esi,sizeof.ct_data
add esi,[tree] ;esi = &tree[m] add esi,[tree] ;esi = &tree[m]
@ -786,9 +784,11 @@ align 4
@@: @@:
dec ecx dec ecx
jmp .cycle4 jmp .cycle4
align 4
.cycle4end: .cycle4end:
dec dword[bits] dec dword[bits]
jmp .cycle3 jmp .cycle3
align 4
.end_f: .end_f:
popad popad
ret ret
@ -913,30 +913,26 @@ endl
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
cmp ecx,0 mov edx,[tree]
jle .cycle0end xor ecx,ecx
xor edx,edx
.cycle0: ;for (..;..<..;..) .cycle0: ;for (..;..<..;..)
mov eax,edx cmp ecx,[elems]
imul eax,sizeof.ct_data jge .cycle0end
add eax,[tree] cmp word[edx+Freq],0
cmp word[eax+Freq],0
je @f ;if (..!=0) je @f ;if (..!=0)
inc dword[edi+deflate_state.heap_len] inc dword[edi+deflate_state.heap_len]
mov eax,[edi+deflate_state.heap_len] mov eax,[edi+deflate_state.heap_len]
mov [max_code],edx mov [max_code],ecx
mov [edi+deflate_state.heap+2*eax],dx mov [edi+deflate_state.heap+2*eax],cx
mov eax,edx mov byte[edi+deflate_state.depth+ecx],0
add eax,edi
add eax,deflate_state.depth
mov byte[eax],0
jmp .end0 jmp .end0
align 4 align 4
@@: ;else @@: ;else
mov word[eax+Len],0 mov word[edx+Len],0
.end0: .end0:
inc edx add edx,sizeof.ct_data
loop .cycle0 inc ecx
jmp .cycle0
align 4 align 4
.cycle0end: .cycle0end:
@ -1025,12 +1021,10 @@ align 4
mov eax,ecx mov eax,ecx
add eax,edi add eax,edi
add eax,deflate_state.depth mov al,byte[eax+deflate_state.depth]
mov al,byte[eax]
mov edx,[m] mov edx,[m]
add edx,edi add edx,edi
add edx,deflate_state.depth mov ah,byte[edx+deflate_state.depth]
mov ah,byte[edx]
cmp al,ah cmp al,ah
jl @f ;if (al>=ah) al=al : al=ah jl @f ;if (al>=ah) al=al : al=ah
mov al,ah mov al,ah
@ -1038,8 +1032,7 @@ align 4
inc al inc al
mov edx,[node] mov edx,[node]
add edx,edi add edx,edi
add edx,deflate_state.depth mov byte[edx+deflate_state.depth],al
mov byte[edx],al
mov eax,[node] mov eax,[node]
mov edx,[m] mov edx,[m]
@ -1143,8 +1136,7 @@ endl
mov eax,[curlen] mov eax,[curlen]
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
add eax,edi add eax,edi
add eax,deflate_state.bl_tree+Freq add word[eax+deflate_state.bl_tree+Freq],bx
add word[eax],bx
jmp .end4 jmp .end4
.end1: .end1:
cmp dword[curlen],0 cmp dword[curlen],0
@ -1154,14 +1146,12 @@ endl
je @f ;if (..!=..) je @f ;if (..!=..)
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
add eax,edi add eax,edi
add eax,deflate_state.bl_tree+Freq inc word[eax+deflate_state.bl_tree+Freq]
inc word[eax]
@@: @@:
mov eax,REP_3_6 mov eax,REP_3_6
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
add eax,edi add eax,edi
add eax,deflate_state.bl_tree+Freq inc word[eax+deflate_state.bl_tree+Freq]
inc word[eax]
jmp .end4 jmp .end4
.end2: .end2:
cmp ebx,10 cmp ebx,10
@ -1169,15 +1159,13 @@ endl
mov eax,REPZ_3_10 mov eax,REPZ_3_10
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
add eax,edi add eax,edi
add eax,deflate_state.bl_tree+Freq inc word[eax+deflate_state.bl_tree+Freq]
inc word[eax]
jmp .end4 jmp .end4
.end3: ;else .end3: ;else
mov eax,REPZ_11_138 mov eax,REPZ_11_138
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
add eax,edi add eax,edi
add eax,deflate_state.bl_tree+Freq inc word[eax+deflate_state.bl_tree+Freq]
inc word[eax]
.end4: .end4:
mov dword[curlen],0 mov dword[curlen],0
mov eax,[curlen] mov eax,[curlen]
@ -1230,13 +1218,13 @@ endl
mov eax,[tree] mov eax,[tree]
movzx eax,word[eax+Len] movzx eax,word[eax+Len]
mov [nextlen],eax mov [nextlen],eax
cmp eax,0 xor ecx,ecx
jne @f ;if (..==0) test eax,eax
jnz .cycle0 ;if (..==0)
mov dword[max_count],138 mov dword[max_count],138
mov dword[min_count],3 mov dword[min_count],3
@@:
xor ecx,ecx align 4
.cycle0: ;for (..;..<=..;..) .cycle0: ;for (..;..<=..;..)
cmp ecx,[max_code] cmp ecx,[max_code]
jg .cycle0end jg .cycle0end
@ -1257,6 +1245,7 @@ endl
jne .end0 ;if (..<.. && ..==..) jne .end0 ;if (..<.. && ..==..)
inc ecx inc ecx
jmp .cycle0 ;continue jmp .cycle0 ;continue
align 4
.end0: .end0:
cmp ebx,[min_count] cmp ebx,[min_count]
jge .end1 ;else if (..<..) jge .end1 ;else if (..<..)
@ -1265,8 +1254,7 @@ endl
add ebx,deflate_state.bl_tree add ebx,deflate_state.bl_tree
send_code edi, [curlen], ebx send_code edi, [curlen], ebx
dec dword[count] dec dword[count]
cmp dword[count],0 jnz @b ;while (..!=0)
jne @b ;while (..!=0)
jmp .end4 jmp .end4
align 4 align 4
.end1: .end1:
@ -1378,10 +1366,10 @@ endl
movzx eax,byte[eax] movzx eax,byte[eax]
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
add eax,edi add eax,edi
add eax,deflate_state.bl_tree+Len cmp word[eax+deflate_state.bl_tree+Len],0
cmp word[eax],0
jne .cycle0end ;if (..!=0) break jne .cycle0end ;if (..!=0) break
jmp .cycle0 jmp .cycle0
align 4
.cycle0end: .cycle0end:
; Update opt_len to include the bit length tree and counts ; Update opt_len to include the bit length tree and counts
mov eax,[max_blindex] mov eax,[max_blindex]
@ -1445,10 +1433,9 @@ proc send_all_trees uses eax ebx ecx edi, s:dword, lcodes:dword, dcodes:dword, b
add eax,bl_order add eax,bl_order
movzx eax,byte[eax] movzx eax,byte[eax]
imul eax,sizeof.ct_data imul eax,sizeof.ct_data
mov ebx,edi add eax,edi
add ebx,deflate_state.bl_tree+Len movzx eax,word[eax+deflate_state.bl_tree+Len]
add ebx,eax stdcall send_bits, edi, eax, 3
stdcall send_bits, edi, ebx, 3
inc ecx inc ecx
jmp .cycle0 jmp .cycle0
align 4 align 4
@ -1989,7 +1976,7 @@ proc bi_reverse uses ebx, p1code:dword, len:dword
dec dword[len] dec dword[len]
cmp dword[len],0 cmp dword[len],0
jg @b ;while (..>..) jg @b ;while (..>..)
shl eax,1 shr eax,1
ret ret
endp endp