private void BasicNumberCompaction(byte[] input, int start, int length) {
int ret = cwPtr;
int retLast = length / 3;
int ni, k;
cwPtr += retLast + 1;
for (k = 0; k <= retLast; ++k)
codewords[ret + k] = 0;
codewords[ret + retLast] = 1;
length += start;
for (ni = start; ni < length; ++ni) {
// multiply by 10
for (k = retLast; k >= 0; --k)
codewords[ret + k] *= 10;
// add the digit
codewords[ret + retLast] += input[ni] - '0';
// propagate carry
for (k = retLast; k > 0; --k) {
codewords[ret + k - 1] += codewords[ret + k] / 900;
codewords[ret + k] %= 900;
}
}
}