internal static int ReadVariableInternal(Buffer buffer, out uint value) { // Unsigned LEB128 decoding value = 0U; int i, shift = 0; for (i = 0; i < 5; ++i) { buffer.CheckLengthToRead(1); byte b = buffer.GetByte(); value |= (((uint)b & 0x7fU) << shift); if ((b & 0x80) == 0) { break; } shift += 7; } return(i < 5 ? (i + 1) : 5); }
// Overloaded Read for primitive types /// <summary> /// Decodes a boolean value out of the underlying buffer. /// </summary> public void Read(out bool value) { buffer.CheckLengthToRead(1); value = (buffer.GetByte() != 0); }