Skip to content

Commit

Permalink
TONY: Remove dummy defines
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Mar 1, 2014
1 parent 8d8bf74 commit 9d8477b
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions engines/tony/mpal/lzo.cpp
Expand Up @@ -69,15 +69,9 @@ namespace Tony {
namespace MPAL {

#define pd(a, b) ((uint32) ((a) - (b)))

#define TEST_IP (ip < ip_end)
#define TEST_OP 1
#define NEED_IP(x) ((void) 0)
#define NEED_OP(x) ((void) 0)
#define TEST_LB(m_pos) ((void) 0)

#define M2_MAX_OFFSET 0x0800
#define LZO1X

/**
* Decompresses an LZO compressed resource
Expand All @@ -100,36 +94,30 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
if (t < 4)
goto match_next;
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) {
t = *ip++;
if (t >= 16)
goto match;
if (t == 0) {
NEED_IP(1);
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++;
*op++ = *ip++;
while (--t > 0);

first_literal_run:
Expand All @@ -141,9 +129,6 @@ 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;
Expand All @@ -157,18 +142,14 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
m_pos -= (t >> 2) & 7;
m_pos -= *ip++ << 3;
t = (t >> 5) - 1;
TEST_LB(m_pos);
assert(t > 0);
NEED_OP(t + 3 - 1);
goto copy_match;
} else if (t >= 32) {
t &= 31;
if (t == 0) {
NEED_IP(1);
while (*ip == 0) {
t += 255;
ip++;
NEED_IP(1);
}
t += 31 + *ip++;
}
Expand All @@ -180,11 +161,9 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
m_pos -= (t & 8) << 11;
t &= 7;
if (t == 0) {
NEED_IP(1);
while (*ip == 0) {
t += 255;
ip++;
NEED_IP(1);
}
t += 7 + *ip++;
}
Expand All @@ -197,16 +176,12 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
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;
goto match_done;
}

TEST_LB(m_pos);
assert(t > 0);
NEED_OP(t + 3 - 1);
{
copy_match:
*op++ = *m_pos++;
Expand All @@ -224,16 +199,14 @@ int lzo1x_decompress(const byte *in, uint32 in_len, byte *out, uint32 *out_len)
match_next:
assert(t > 0);
assert(t < 4);
NEED_OP(t);
NEED_IP(t + 1);
*op++ = *ip++;
if (t > 1) {
*op++ = *ip++;
if (t > 2)
*op++ = *ip++;
}
t = *ip++;
} while (TEST_IP && TEST_OP);
} while (TEST_IP);
}

eof_found:
Expand Down

0 comments on commit 9d8477b

Please sign in to comment.