Fixed Zero Run Length Compression

This commit is contained in:
HikikoMarmy
2025-06-15 23:08:40 +01:00
parent fffbc95b87
commit 8f93287ada

View File

@@ -45,17 +45,16 @@ namespace RLEZ
}
else
{
// Start of a zero run — count how many consecutive 0x00s
size_t zeroCount = 0;
size_t start = i;
i++;
// Count all proceeding 00's
while( i < input.size() && input[ i ] == 0x00 && zeroCount < 255 )
{
++i;
++zeroCount;
}
// Emit zero-run marker and count (DO NOT emit any 0x00s literally)
output.push_back( 0x00 );
output.push_back( static_cast< uint8_t >( zeroCount ) );
}