(lz) Progress in tal impl

This commit is contained in:
neauoire 2023-11-18 11:35:27 -08:00
parent 6b3fe57067
commit a6343d0697
2 changed files with 12 additions and 5 deletions

View File

@ -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) {

View File

@ -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
(