Exemplo n.º 1
0
 /// <summary>
 /// Reads a 4 byte integer from the buffer, as a 1-5 byte varint in big endian,
 /// regarldess of platform.
 ///
 /// Signed integers are encoded via zigzag encoding for more efficient encoding
 /// of negative values. See:
 /// https://developers.google.com/protocol-buffers/docs/encoding#signed-integers
 /// for more information.
 ///
 /// See: http://sqlite.org/src4/doc/trunk/www/varint.wiki
 /// </summary>
 public static int ReadInt32 <T>(this ref T deserializer) where T : struct, IDeserializer
 => (int)ZigZag.Decode(deserializer.ReadUInt32());
Exemplo n.º 2
0
 /// <summary>
 /// Reads a 8 byte integer from the buffer, as a 1-9 byte varint in big endian,
 /// regarldess of platform.
 ///
 /// Signed integers are encoded via zigzag encoding for more efficient encoding
 /// of negative values. See:
 /// https://developers.google.com/protocol-buffers/docs/encoding#signed-integers
 /// for more information.
 ///
 /// See: http://sqlite.org/src4/doc/trunk/www/varint.wiki
 /// </summary>
 public static long ReadInt64 <T>(this ref T deserializer) where T : struct, IDeserializer
 => (long)ZigZag.Decode(deserializer.ReadUInt64());
Exemplo n.º 3
0
 /// <summary>
 /// Reads a 2 byte short from the buffer, as a 1-3 byte varint in big endian,
 /// regarldess of platform.
 ///
 /// Signed integers are encoded via zigzag encoding for more efficient encoding
 /// of negative values. See:
 /// https://developers.google.com/protocol-buffers/docs/encoding#signed-integers
 /// for more information.
 ///
 /// See: http://sqlite.org/src4/doc/trunk/www/varint.wiki
 /// </summary>
 public static short ReadInt16 <T>(this ref T deserializer) where T : struct, IDeserializer
 => (short)ZigZag.Decode(deserializer.ReadUInt16());