mirror of
https://github.com/HikikoMarmy/Champions-Reborn-Server.git
synced 2026-04-11 11:29:47 -03:00
Fixed Zero Run Length Compression
This commit is contained in:
@@ -45,17 +45,16 @@ namespace RLEZ
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Start of a zero run — count how many consecutive 0x00s
|
|
||||||
size_t zeroCount = 0;
|
size_t zeroCount = 0;
|
||||||
size_t start = i;
|
i++;
|
||||||
|
|
||||||
|
// Count all proceeding 00's
|
||||||
while( i < input.size() && input[ i ] == 0x00 && zeroCount < 255 )
|
while( i < input.size() && input[ i ] == 0x00 && zeroCount < 255 )
|
||||||
{
|
{
|
||||||
++i;
|
++i;
|
||||||
++zeroCount;
|
++zeroCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emit zero-run marker and count (DO NOT emit any 0x00s literally)
|
|
||||||
output.push_back( 0x00 );
|
output.push_back( 0x00 );
|
||||||
output.push_back( static_cast< uint8_t >( zeroCount ) );
|
output.push_back( static_cast< uint8_t >( zeroCount ) );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user