Discussion:
int replaceZero(int uselessParameter)
(too old to reply)
Brandon Streiff
2005-10-03 17:01:59 UTC
Permalink
/* only used in OptAdaptive */
int replaceZero( int index )
{
// code that does not use the 'index' parameter at all
}

/* only used in RevAdaptive */
int removeZero( int index )
{
// code that does not use the 'index' parameter at all
}


... seriously, what the hell?

-- brandon
Garett Bass
2005-10-03 17:32:04 UTC
Permalink
Here's a clever algorithm in RevAdaptive.decompress():

/* read counts */
for (i = 0; i < 0x100; i++)
counts[i] = inFile.readBits(32);

/* derive old file length */
int fileLength = 0;
for (i = 0; i < 0x100; i++)
fileLength += counts[i];
Brandon Streiff
2005-10-03 17:56:26 UTC
Permalink
Post by Brandon Streiff
/* only used in OptAdaptive */
int replaceZero( int index )
{
// code that does not use the 'index' parameter at all
}
/* only used in RevAdaptive */
int removeZero( int index )
{
// code that does not use the 'index' parameter at all
}
... seriously, what the hell?
-- brandon
Okay, just talked with Warren about this-- apparently it's because, in
other representations of the tree, we may not know where our zero-node
is. However, with this array-based method, the zero-node always happens
to be the leftmost node (due to sorted order); therefore the index is
unnecessary.

Still kinda odd to have the parameter, though...

-- brandon

Loading...