Exemplo n.º 1
0
        public static float PeekFloat(this RailBitBuffer buffer, RailFloatCompressor compressor)
        {
            if (compressor.RequiredBits > RailConfig.VARINT_FALLBACK_SIZE)
            {
                return(compressor.Unpack(buffer.PeekUInt()));
            }

            return(compressor.Unpack(buffer.Peek(compressor.RequiredBits)));
        }
Exemplo n.º 2
0
 public static void WriteFloat(
     this RailBitBuffer buffer,
     RailFloatCompressor compressor,
     float value)
 {
     if (compressor.RequiredBits > RailConfig.VARINT_FALLBACK_SIZE)
     {
         buffer.WriteUInt(compressor.Pack(value));
     }
     else
     {
         buffer.Write(compressor.RequiredBits, compressor.Pack(value));
     }
 }
Exemplo n.º 3
0
 public static void ReadFloats(
     this RailBitBuffer buffer,
     RailFloatCompressor compressor,
     float[] 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));
         }
     }
 }