Here goes using no pointers (C# safe)...
var[] curtable = table;
i = start[k];
int idx = i >> m;
i <<= tablebits;
n = k - tablebits;
/* make tree (n length) */
while (--n >= 0)
{
if (curtable[idx] == 0)
{
right[avail] = left[avail] = 0;
curtable[idx] = avail++;
}
if (i & 0x8000)
{
idx = curtable[idx];
curtable = right;
}
else
{
idx = curtable[idx];
curtable = left;
}
i <<= 1;
}
curtable[idx] = j;