public static VInt ReadUInt(Stream s)
{
int b = s.ReadByte();
if (b<0) throw new EndOfStreamException();
int len = CheckLength(b);
var bin = new byte[len];
bin[0] = (byte)b;
long res = b;
for (var i=1; i<len; i++) {
b = s.ReadByte();
if (b<0) throw new EndOfStreamException();
bin[i] = (byte)b;
res = (res<<8) | (byte)b;
}
res &= (1<<(7*len))-1;
return new VInt(res, bin);
}