mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-09-28 00:54:28 +00:00
tidying
This commit is contained in:
parent
59f794906e
commit
3e1d9d65ca
@ -20,6 +20,7 @@ public class ExoBuffer
|
|||||||
|
|
||||||
private int inPos;
|
private int inPos;
|
||||||
private int outPos;
|
private int outPos;
|
||||||
|
private int srcPtr;
|
||||||
|
|
||||||
private int bitBuffer;
|
private int bitBuffer;
|
||||||
private int flags;
|
private int flags;
|
||||||
@ -117,12 +118,10 @@ public class ExoBuffer
|
|||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
if ((flags & PFLAG_BITS_COPY_GT_7) != 0)
|
if ((flags & PFLAG_BITS_COPY_GT_7) != 0)
|
||||||
{
|
|
||||||
while (count > 7)
|
while (count > 7)
|
||||||
{
|
{
|
||||||
byteCopy = count >>> 3;
|
byteCopy = count >>> 3;
|
||||||
count &= 7;
|
count &= 0x07;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
@ -138,10 +137,7 @@ public class ExoBuffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (byteCopy-- > 0)
|
while (byteCopy-- > 0)
|
||||||
{
|
value = (value << 8) | getByte ();
|
||||||
value <<= 8;
|
|
||||||
value |= getByte ();
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -198,7 +194,9 @@ public class ExoBuffer
|
|||||||
|
|
||||||
tableBi[i] = b;
|
tableBi[i] = b;
|
||||||
}
|
}
|
||||||
// tableDump ();
|
|
||||||
|
if (false)
|
||||||
|
tableDump ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
@ -223,9 +221,9 @@ public class ExoBuffer
|
|||||||
private void decrunch ()
|
private void decrunch ()
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
inPos = 2;
|
inPos = 2; // skip address
|
||||||
outPos = 0;
|
outPos = 0;
|
||||||
flags = 23;
|
flags = 23; // hard-coded for Total Replay
|
||||||
|
|
||||||
if ((flags & PFLAG_BITS_ALIGN_START) != 0)
|
if ((flags & PFLAG_BITS_ALIGN_START) != 0)
|
||||||
bitBuffer = 0;
|
bitBuffer = 0;
|
||||||
@ -235,7 +233,6 @@ public class ExoBuffer
|
|||||||
tableInit ();
|
tableInit ();
|
||||||
|
|
||||||
int len;
|
int len;
|
||||||
int srcPtr = 0;
|
|
||||||
boolean literal;
|
boolean literal;
|
||||||
int threshold = (flags & PFLAG_4_OFFSET_TABLES) != 0 ? 4 : 3;
|
int threshold = (flags & PFLAG_4_OFFSET_TABLES) != 0 ? 4 : 3;
|
||||||
|
|
||||||
@ -243,19 +240,19 @@ public class ExoBuffer
|
|||||||
{
|
{
|
||||||
len = 1;
|
len = 1;
|
||||||
literal = true;
|
literal = true;
|
||||||
srcPtr = copy (len, literal, srcPtr);
|
copy (len, literal);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (getBits (1) != 0)
|
if (getBits (1) == 1)
|
||||||
{
|
{
|
||||||
len = 1;
|
len = 1;
|
||||||
literal = true;
|
literal = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int val = getGammaCode ();
|
int val = getGammaCode (); // count zero bits
|
||||||
|
|
||||||
if (val == 16)
|
if (val == 16)
|
||||||
break;
|
break;
|
||||||
@ -274,7 +271,7 @@ public class ExoBuffer
|
|||||||
srcPtr = outPos - getCooked (tableOff[i] + getBits (tableBit[i]));
|
srcPtr = outPos - getCooked (tableOff[i] + getBits (tableBit[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
srcPtr = copy (len, literal, srcPtr);
|
copy (len, literal);
|
||||||
}
|
}
|
||||||
assert outPos == outBuffer.length;
|
assert outPos == outBuffer.length;
|
||||||
}
|
}
|
||||||
@ -295,21 +292,18 @@ public class ExoBuffer
|
|||||||
private int getCooked (int index)
|
private int getCooked (int index)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
int base = tableLo[index] | (tableHi[index] << 8);
|
return ((tableHi[index] << 8) | tableLo[index]) + getBits (tableBi[index]);
|
||||||
return base + getBits (tableBi[index]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
private int copy (int len, boolean literal, int src)
|
private void copy (int len, boolean literal)
|
||||||
// ---------------------------------------------------------------------------------//
|
// ---------------------------------------------------------------------------------//
|
||||||
{
|
{
|
||||||
do
|
assert len > 0;
|
||||||
|
while (len-- > 0)
|
||||||
{
|
{
|
||||||
int val = literal ? getByte () : outBuffer[src++];
|
int val = literal ? getByte () : outBuffer[srcPtr++];
|
||||||
outBuffer[outPos++] = (byte) (val & 0xFF);
|
outBuffer[outPos++] = (byte) (val & 0xFF);
|
||||||
|
}
|
||||||
} while (--len > 0);
|
|
||||||
|
|
||||||
return src;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user