示例#1
0
 public static void ReadInts(
     this RailBitBuffer buffer,
     RailIntCompressor compressor,
     int[] toStore)
 {
     if (compressor.RequiredBits > RailConfig.VARINT_FALLBACK_SIZE)
     {
         for (int i = 0; i < toStore.Length; i++)
         {
             toStore[i] = compressor.Unpack(buffer.ReadUInt());
         }
     }
     else
     {
         for (int i = 0; i < toStore.Length; i++)
         {
             toStore[i] = compressor.Unpack(buffer.Read(compressor.RequiredBits));
         }
     }
 }
示例#2
0
 public static void WriteInts(
     this RailBitBuffer buffer,
     RailIntCompressor compressor,
     int[] values)
 {
     if (compressor.RequiredBits > RailConfig.VARINT_FALLBACK_SIZE)
     {
         foreach (int value in values)
         {
             buffer.WriteUInt(compressor.Pack(value));
         }
     }
     else
     {
         foreach (int value in values)
         {
             buffer.Write(compressor.RequiredBits, compressor.Pack(value));
         }
     }
 }