src/StructuredLogger/BinaryLogger/Utilities.cs [366:391]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Read7BitEncodedInt(this BinaryReader reader) { // Read out an Int32 7 bits at a time. The high bit // of the byte when on means to continue reading more bytes. int count = 0; int shift = 0; byte b; do { // Check for a corrupted stream. Read a max of 5 bytes. // In a future version, add a DataFormatException. if (shift == 5 * 7) // 5 bytes max per Int32, shift += 7 { throw new FormatException(); } // ReadByte handles end of stream cases for us. b = reader.ReadByte(); count |= (b & 0x7F) << shift; shift += 7; } while ((b & 0x80) != 0); return count; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src/StructuredLogger/Serialization/Serialization.cs [213:238]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int Read7BitEncodedInt(this BinaryReader reader) { // Read out an Int32 7 bits at a time. The high bit // of the byte when on means to continue reading more bytes. int count = 0; int shift = 0; byte b; do { // Check for a corrupted stream. Read a max of 5 bytes. // In a future version, add a DataFormatException. if (shift == 5 * 7) // 5 bytes max per Int32, shift += 7 { throw new FormatException(); } // ReadByte handles end of stream cases for us. b = reader.ReadByte(); count |= (b & 0x7F) << shift; shift += 7; } while ((b & 0x80) != 0); return count; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -