Merge pull request #3581 from stalefishies/compression-contract-fix

BUGFIX: Handle edge case in LZ compression code and fix docs
This commit is contained in:
hydroflame
2022-05-04 11:53:29 -04:00
committed by GitHub
3 changed files with 38 additions and 30 deletions
+7
View File
@@ -105,6 +105,13 @@ export function comprLZEncode(plain: string): string {
// start new literal
set(new_state, 0, 1, string + length + offset);
// end current backreference and start new backreference
for (let new_offset = 1; new_offset <= Math.min(9, i); ++new_offset) {
if (plain[i - new_offset] === c) {
set(new_state, new_offset, 1, string + length + offset + "0");
}
}
}
}