Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jozkee committed Jul 18, 2023
1 parent 43fe8a8 commit 02e83b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ private static void WriteFloatingPointConstant(Utf8JsonWriter writer, Half value
}
}

// Half.TryFormat/TryParse(ROS<byte>) are not available on .NET 7
// we need to use Half.TryFormat/TryParse(ROS<char>) in that case.
private static bool TryParse(ReadOnlySpan<byte> buffer, out Half result)
{
#if NET8_0_OR_GREATER
bool success = Half.TryParse(buffer, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out result);
#else
// Half.TryFormat/TryParse(ROS<byte>) are not available on .NET 7
// we need to use Half.TryFormat/TryParse(ROS<char>) in that case.
char[]? rentedCharBuffer = null;

Span<char> charBuffer = buffer.Length <= JsonConstants.StackallocCharThreshold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,7 @@ private async Task AssertUnsupportedFormatThrows<T>()
{
string[] testCases = new[]
{
"01", // leading zeroes
"$123.46", // Currency
"100.00 %", // Percent
"1234,57", // Fixed point
Expand Down

0 comments on commit 02e83b3

Please sign in to comment.