PREV INDEX NEXT

Author: Unknown
Subject: get/put less than 8 bits?
Date: Wednesday, 11 Nov 2020, 06:45:15

I am trying to follow Richard's suggestion of writing 5 bits for MAXBITS and 1 bit for PRUNING, but I am getting the following output when trying to get the 6 bits that I put:

encode:
putBits(5, 12);
putBits(1, 0);

decode:
long maxbits = getBits(5);
long pruning = getBits(1);
printf("%ld %ld\n", maxbits, pruning);

% ./encode > out.txt
% ./decode < out.txt
-1 -1

Is there a fix for this?
PREV INDEX NEXT