(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);
|
string_len = (int)(end - in);
|
||||||
if(string_len > 0x3FFF + MinMatchLength)
|
if(string_len > 0x3FFF + MinMatchLength)
|
||||||
string_len = 0x3FFF + MinMatchLength;
|
string_len = 0x3FFF + MinMatchLength;
|
||||||
|
/* DEBUG: printf("%04x %04x \n", dict_len, string_len); */
|
||||||
|
|
||||||
/* Iterate through the dictionary */
|
/* Iterate through the dictionary */
|
||||||
for(dict = in - dict_len, match_len = 0; dict_len; dict++, dict_len -= 1) {
|
for(dict = in - dict_len, match_len = 0; dict_len; dict++, dict_len -= 1) {
|
||||||
|
|
|
@ -37,10 +37,16 @@
|
||||||
@uxn_lz_compress ( input* length* -- )
|
@uxn_lz_compress ( input* length* -- )
|
||||||
ADD2k NIP2 SWP2
|
ADD2k NIP2 SWP2
|
||||||
&w ( -- )
|
&w ( -- )
|
||||||
( body )
|
( | get available dictionary size )
|
||||||
INC2 DUP2 phex #0a18 DEO
|
DUP2 ;raw SUB2 #0100 LTH2k ?{ SWP2 }
|
||||||
|
POP2 ,&dict-len STR2
|
||||||
NEQ2k ?&w
|
( | 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
|
JMP2r
|
||||||
|
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in New Issue