Fix LZ11 compression.
This commit is contained in:
parent
553949f57b
commit
6e01561b5e
@ -19,25 +19,27 @@ u32 lz11_get_occurence_length(u8* newPtr, u32 newLength, u8* oldPtr, u32 oldLeng
|
||||
}
|
||||
|
||||
u32 maxLength = 0;
|
||||
for(u32 i = 0; i < oldLength - 1; i++) {
|
||||
u8* currentOldStart = oldPtr + i;
|
||||
u32 currentLength = 0;
|
||||
for(u32 j = 0; j < newLength; j++) {
|
||||
if(*(currentOldStart + j) != *(newPtr + j)) {
|
||||
break;
|
||||
if(oldLength > 0) {
|
||||
for(u32 i = 0; i < oldLength - 1; i++) {
|
||||
u8* currentOldStart = oldPtr + i;
|
||||
u32 currentLength = 0;
|
||||
for(u32 j = 0; j < newLength; j++) {
|
||||
if(*(currentOldStart + j) != *(newPtr + j)) {
|
||||
break;
|
||||
}
|
||||
|
||||
currentLength++;
|
||||
}
|
||||
|
||||
currentLength++;
|
||||
}
|
||||
if(currentLength > maxLength) {
|
||||
maxLength = currentLength;
|
||||
if(disp != NULL) {
|
||||
*disp = oldLength - i;
|
||||
}
|
||||
|
||||
if(currentLength > maxLength) {
|
||||
maxLength = currentLength;
|
||||
if(disp != NULL) {
|
||||
*disp = oldLength - i;
|
||||
}
|
||||
|
||||
if(maxLength == newLength) {
|
||||
break;
|
||||
if(maxLength == newLength) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user