コード例 #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
ファイル: RailStateTest.cs プロジェクト: araex/RailgunNet
        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));
         }
     }
 }