示例#1
0
        internal Golomb(int divisor)
        {
            if (divisor < 2)
            {
                throw new ArgumentOutOfRangeException();
            }

            this.divisor  = divisor;
            remainderCode = Codes.TruncatedBinary(divisor);
            var r = remainderCode.MaxEncodable;

            maxEncodable = divisor * (63 - remainderCode.GetCode(r).Length) + r;
        }
示例#2
0
        internal BaseN(int n)
        {
            this.n = n;

            if (Bits.IsPowerOf2(n))
            {
                encoding = Codes.FixedWidth(Bits.FloorLog2(n) + 1);
            }
            else
            {
                encoding = Codes.TruncatedBinary(n);
            }
        }
示例#3
0
 public void TruncatedBinaryTest()
 {
     EncodingTest(Codes.TruncatedBinary(6000));
 }