Update HuffmanDecoder.cs

Fix not so obvious errors.
This commit is contained in:
Sławomir Śpiewak 2024-08-11 15:41:21 +02:00
parent 57749e5cac
commit ed0f0489d3

View File

@ -143,7 +143,7 @@ namespace GameRes.Formats.DxLib
ushort BitArrayFirstBatch;
if (nodes[j].bitNumber > 9) continue;
BitArrayFirstBatch = (ushort)(nodes[j].bitArray[0] | (nodes[j].bitNumber << 8));
BitArrayFirstBatch = (ushort)(nodes[j].bitArray[0] | (nodes[j].bitArray[1] << 8));
if ((i & bitMask[nodes[j].bitNumber - 1]) == (BitArrayFirstBatch & bitMask[nodes[j].bitNumber-1]))
{
@ -191,9 +191,11 @@ namespace GameRes.Formats.DxLib
{
PressBitData >>= nodes[NodeIndex].bitNumber;
}
while (NodeIndex>255)
}
while (NodeIndex > 255)
{
if (PressBitCounter==8)
if (PressBitCounter == 8)
{
PressSizeCounter++;
PressBitData = compressedData[PressSizeCounter];
@ -204,7 +206,6 @@ namespace GameRes.Formats.DxLib
PressBitCounter++;
NodeIndex = nodes[NodeIndex].ChildNode[Index];
}
}
m_output[DestSizeCounter] = (byte)NodeIndex;
}