Exemple #1
0
 // it could only distinguish unsigned varint32 and varint8
 public static (byte[], VarintType) ToVarint(uint value)
 {
     if (value < 0x80)
     {
         return(VarintBitConverter.GetVarintBytes((byte)value), VarintType.Varint8);
     }
     else
     {
         return(VarintBitConverter.GetVarintBytes(value), VarintType.Varint32);
     }
 }
Exemple #2
0
 // it could only distinguish unsigned varint32 and varint8
 public static byte[] ToVarint(uint value, VarintType type)
 {
     if (type == VarintType.Varint8)
     {
         return(VarintBitConverter.GetVarintBytes((byte)value));
     }
     else
     {
         return(VarintBitConverter.GetVarintBytes(value));
     }
 }