mirror of
https://github.com/google/brotli.git
synced 2024-11-09 13:40:06 +00:00
Transpile Java speedup (#548)
This commit is contained in:
parent
4363f2d74b
commit
0a84e9bf86
@ -852,10 +852,24 @@ namespace Org.Brotli.Dec
|
|||||||
case Org.Brotli.Dec.RunningState.CopyLoop:
|
case Org.Brotli.Dec.RunningState.CopyLoop:
|
||||||
{
|
{
|
||||||
// fall through
|
// fall through
|
||||||
|
int src = (state.pos - state.distance) & ringBufferMask;
|
||||||
|
int dst = state.pos;
|
||||||
|
int copyLength = state.copyLength - state.j;
|
||||||
|
if ((src + copyLength < ringBufferMask) && (dst + copyLength < ringBufferMask))
|
||||||
|
{
|
||||||
|
for (int k = 0; k < copyLength; ++k)
|
||||||
|
{
|
||||||
|
ringBuffer[dst++] = ringBuffer[src++];
|
||||||
|
}
|
||||||
|
state.j += copyLength;
|
||||||
|
state.metaBlockLength -= copyLength;
|
||||||
|
state.pos += copyLength;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (; state.j < state.copyLength; )
|
for (; state.j < state.copyLength; )
|
||||||
{
|
{
|
||||||
ringBuffer[state.pos] = ringBuffer[(state.pos - state.distance) & ringBufferMask];
|
ringBuffer[state.pos] = ringBuffer[(state.pos - state.distance) & ringBufferMask];
|
||||||
// TODO: condense
|
|
||||||
state.metaBlockLength--;
|
state.metaBlockLength--;
|
||||||
state.j++;
|
state.j++;
|
||||||
if (state.pos++ == ringBufferMask)
|
if (state.pos++ == ringBufferMask)
|
||||||
@ -867,6 +881,7 @@ namespace Org.Brotli.Dec
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (state.runningState == Org.Brotli.Dec.RunningState.CopyLoop)
|
if (state.runningState == Org.Brotli.Dec.RunningState.CopyLoop)
|
||||||
{
|
{
|
||||||
state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
|
state.runningState = Org.Brotli.Dec.RunningState.MainLoop;
|
||||||
|
Loading…
Reference in New Issue
Block a user