Skip to content

Commit

Permalink
[Exporter.Prometheus] remove redundant if in WriteUnicodeNoEscape (#6077
Browse files Browse the repository at this point in the history
)

Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com>
Co-authored-by: Mikel Blanchard <mblanchard@macrosssoftware.com>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent 275a446 commit b508b84
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,13 @@ public static int WriteUnicodeNoEscape(byte[] buffer, int cursor, ushort ordinal
buffer[cursor++] = unchecked((byte)(0b_1100_0000 | (ordinal >> 6)));
buffer[cursor++] = unchecked((byte)(0b_1000_0000 | (ordinal & 0b_0011_1111)));
}
else if (ordinal <= 0xFFFF)
else
{
// all other <= 0xFFFF which is ushort.MaxValue
buffer[cursor++] = unchecked((byte)(0b_1110_0000 | (ordinal >> 12)));
buffer[cursor++] = unchecked((byte)(0b_1000_0000 | ((ordinal >> 6) & 0b_0011_1111)));
buffer[cursor++] = unchecked((byte)(0b_1000_0000 | (ordinal & 0b_0011_1111)));
}
else
{
Debug.Assert(ordinal <= 0xFFFF, ".NET string should not go beyond Unicode BMP.");
}

return cursor;
}
Expand Down

0 comments on commit b508b84

Please sign in to comment.