示例#1
0
 //template<typename BitPacker>
 public bool encodeOmegaSigned(ref BitPacker packer, int val)
 {
    if (!packer.encodeSmall((ushort)((val < 0) ? 1 : 0), 1))
       return false;
           
    if (val < 0)
       val = -val - 1;
       
    return encodeOmega(ref packer, (uint)val);
 }
示例#2
0
      //template<typename BitPacker>
      public bool encodeOmega(ref BitPacker packer, uint val)
      {
         // Most of the time (94% in a few tests) val was 8 bits or less.
         if (val < OmegaCodeTableSize)
            return packer.encodeSmall(mOmegaCodeTable[val].mCode, mOmegaCodeTable[val].mLen);

         int len;
         UInt64 code = getOmegaCode(out len, val);
                           
         return packer.encode(code, len);
      }