(lz) Progress in tal impl
This commit is contained in:
parent
6b3fe57067
commit
a6343d0697
|
@ -33,6 +33,7 @@ uxn_lz_compress(const void *input, int input_size)
|
|||
string_len = (int)(end - in);
|
||||
if(string_len > 0x3FFF + MinMatchLength)
|
||||
string_len = 0x3FFF + MinMatchLength;
|
||||
/* DEBUG: printf("%04x %04x \n", dict_len, string_len); */
|
||||
|
||||
/* Iterate through the dictionary */
|
||||
for(dict = in - dict_len, match_len = 0; dict_len; dict++, dict_len -= 1) {
|
||||
|
|
|
@ -37,10 +37,16 @@
|
|||
@uxn_lz_compress ( input* length* -- )
|
||||
ADD2k NIP2 SWP2
|
||||
&w ( -- )
|
||||
( body )
|
||||
INC2 DUP2 phex #0a18 DEO
|
||||
|
||||
NEQ2k ?&w
|
||||
( | get available dictionary size )
|
||||
DUP2 ;raw SUB2 #0100 LTH2k ?{ SWP2 }
|
||||
POP2 ,&dict-len STR2
|
||||
( | size of the string to search for )
|
||||
SUB2k #3fff #0004 ADD2 LTH2k ?{ SWP2 }
|
||||
POP2 ,&string-len STR2
|
||||
( | itterate through the dictionary )
|
||||
[ LIT2 &dict-len $2 ] phex #2018 DEO
|
||||
[ LIT2 &string-len $2 ] phex #0a18 DEO
|
||||
( TODO: remove me!! ) INC2 NEQ2k ?&w
|
||||
JMP2r
|
||||
|
||||
(
|
||||
|
@ -72,7 +78,7 @@
|
|||
&c ( -- )
|
||||
#0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #18 DEO
|
||||
JMP2r
|
||||
|
||||
|
||||
(
|
||||
@|memory )
|
||||
|
||||
|
|
Loading…
Reference in New Issue