123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- ;
- ;
- ;
- ;
- ;
- ;
- .text
- .file "match.S"
- .text
- .type _match_init,function
- _match_init:
- ret
- _$98:
- .size _match_init,_$98-_match_init
- .globl _match_init
- .align 4
- .type _longest_match,function
- _longest_match:
- push %ebp
- push %edi
- push %esi
- push %ebx
- mov 20(%esp),%esi
- mov _strstart,%edx
- mov _max_chain_length,%ebp
- mov %edx,%edi
- sub $(32768-262),%edx
- cld
- jae limit_ok
- sub %edx,%edx
- limit_ok:
- add $2+_window,%edi
- mov _prev_length,%ebx
- movw -2(%edi),%cx
- movw -3(%ebx,%edi),%ax
- cmp _good_match,%ebx
- jb do_scan
- shr $2,%ebp
- jmp do_scan
- .align 4
- long_loop:
- movw -3(%ebx,%edi),%ax
- movw -2(%edi),%cx
- short_loop:
- and $(32768-1), %esi
- dec %ebp
- movw _prev(,%esi,2),%si
- jz the_end
- cmp %edx,%esi
- jbe the_end
- do_scan:
- cmpw _window-1(%ebx,%esi),%ax
- jne short_loop
- cmpw _window(%esi),%cx
- jne short_loop
- add $2+_window,%esi
- mov $((258>>1)-1),%ecx
- mov %edi,%eax
- repe
- je maxmatch
- mismatch:
- movb -2(%edi),%cl
- xchg %edi,%eax
- subb -2(%esi),%cl
- sub %edi,%eax
- sub $2+_window,%esi
- sub %eax,%esi
- subb $1,%cl
- adc $0,%eax
- cmp %ebx,%eax
- jle long_loop
- mov %esi,_match_start
- mov %eax,%ebx
- cmp _nice_match,%eax
- jl long_loop
- the_end:
- mov %ebx,%eax
- pop %ebx
- pop %esi
- pop %edi
- pop %ebp
- ret
- .align 4
- maxmatch:
- cmpsb
- jmp mismatch
- _$99:
- .size _longest_match,_$99-_longest_match
- .globl _longest_match
- .extern _nice_match
- .extern _good_match
- .extern _max_chain_length
- .extern _match_start
- .extern _strstart
- .extern _prev_length
- .extern _prev
- .extern _window
|