natix.CompactDS.EliasGamma32.Encode C# (CSharp) Method

Encode() public method

public Encode ( BitStream32 Buffer, int u ) : void
Buffer BitStream32
u int
return void
        public void Encode(BitStream32 Buffer, int u)
        {
            if (u < 1) {
                throw new ArgumentOutOfRangeException (String.Format ("Invalid range for elias gamma coding, u: {0}", u));
            }
            var log2 = BitAccess.Log2 (u);
            --log2;
            unary.Encode (Buffer, log2);
            Buffer.Write (u, log2);
        }