예제 #1
0
        public static long ReadInt64(this RailBitBuffer buffer, RailInt64Compressor compressor)
        {
            if (compressor.RequiredBits > RailConfig.VARINT_FALLBACK_SIZE)
            {
                return(compressor.Unpack(buffer.ReadUInt64()));
            }

            return(compressor.Unpack(buffer.Read(compressor.RequiredBits)));
        }
예제 #2
0
        private void ReadWriteUInt64(ulong expected)
        {
            RailBitBuffer buffer = new RailBitBuffer();

            buffer.WriteUInt64(expected);
            ulong actual = buffer.ReadUInt64();

            Assert.Equal(expected, actual);
        }
예제 #3
0
 public static void ReadInt64s(
     this RailBitBuffer buffer,
     RailInt64Compressor compressor,
     long[] toStore)
 {
     if (compressor.RequiredBits > RailConfig.VARINT_FALLBACK_SIZE)
     {
         for (int i = 0; i < toStore.Length; i++)
         {
             toStore[i] = compressor.Unpack(buffer.ReadUInt64());
         }
     }
     else
     {
         for (int i = 0; i < toStore.Length; i++)
         {
             toStore[i] = compressor.Unpack(buffer.Read(compressor.RequiredBits));
         }
     }
 }