Skip to content

Commit

Permalink
TONY: Indent code properly in lzo
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Mar 1, 2014
1 parent 3f6b51c commit 3ace561
Showing 1 changed file with 45 additions and 44 deletions.
89 changes: 45 additions & 44 deletions engines/tony/mpal/lzo.cpp
Expand Up @@ -95,40 +95,44 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
op = out;
ip = in;

if (*ip > 17)
{
if (*ip > 17) {
t = *ip++ - 17;
if (t < 4)
goto match_next;
assert(t > 0); NEED_OP(t); NEED_IP(t+1);
do *op++ = *ip++; while (--t > 0);
assert(t > 0);
NEED_OP(t);
NEED_IP(t + 1);
do
*op++ = *ip++;
while (--t > 0);
goto first_literal_run;
}

while (TEST_IP && TEST_OP)
{
while (TEST_IP && TEST_OP) {
t = *ip++;
if (t >= 16)
goto match;
if (t == 0)
{
if (t == 0) {
NEED_IP(1);
while (*ip == 0)
{
while (*ip == 0) {
t += 255;
ip++;
NEED_IP(1);
}
t += 15 + *ip++;
}
assert(t > 0); NEED_OP(t+3); NEED_IP(t+4);
{
*op++ = *ip++; *op++ = *ip++; *op++ = *ip++;
do *op++ = *ip++; while (--t > 0);
}
assert(t > 0);
NEED_OP(t + 3);
NEED_IP(t + 4);

first_literal_run:
*op++ = *ip++;
*op++ = *ip++;
*op++ = *ip++;
do
*op++ = *ip++;
while (--t > 0);

first_literal_run:
t = *ip++;
if (t >= 16)
goto match;
Expand All @@ -137,32 +141,31 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
m_pos -= t >> 2;
m_pos -= *ip++ << 2;

TEST_LB(m_pos); NEED_OP(3);
*op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos;
TEST_LB(m_pos);
NEED_OP(3);

*op++ = *m_pos++;
*op++ = *m_pos++;
*op++ = *m_pos;

goto match_done;

do {
match:
if (t >= 64)
{

#if defined(LZO1X)
if (t >= 64) {
m_pos = op - 1;
m_pos -= (t >> 2) & 7;
m_pos -= *ip++ << 3;
t = (t >> 5) - 1;
#endif
TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
TEST_LB(m_pos);
assert(t > 0);
NEED_OP(t + 3 - 1);
goto copy_match;
}
else if (t >= 32)
{
} else if (t >= 32) {
t &= 31;
if (t == 0)
{
if (t == 0) {
NEED_IP(1);
while (*ip == 0)
{
while (*ip == 0) {
t += 255;
ip++;
NEED_IP(1);
Expand All @@ -172,17 +175,13 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
m_pos = op - 1;
m_pos -= (ip[0] >> 2) + (ip[1] << 6);
ip += 2;
}
else if (t >= 16)
{
} else if (t >= 16) {
m_pos = op;
m_pos -= (t & 8) << 11;
t &= 7;
if (t == 0)
{
if (t == 0) {
NEED_IP(1);
while (*ip == 0)
{
while (*ip == 0) {
t += 255;
ip++;
NEED_IP(1);
Expand All @@ -194,18 +193,20 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
if (m_pos == op)
goto eof_found;
m_pos -= 0x4000;
}
else
{
} else {
m_pos = op - 1;
m_pos -= t >> 2;
m_pos -= *ip++ << 2;
TEST_LB(m_pos); NEED_OP(2);
*op++ = *m_pos++; *op++ = *m_pos;
TEST_LB(m_pos);
NEED_OP(2);
*op++ = *m_pos++;
*op++ = *m_pos;
goto match_done;
}

TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1);
TEST_LB(m_pos);
assert(t > 0);
NEED_OP(t + 3 - 1);
{
copy_match:
*op++ = *m_pos++; *op++ = *m_pos++;
Expand Down

0 comments on commit 3ace561

Please sign in to comment.