Add comments

pull/8147/head
James Newton-King 4 years ago
parent 818c2ba077
commit e4cd821f21
No known key found for this signature in database
GPG Key ID: A66B2F456BF5526
  1. 2
      csharp/src/Google.Protobuf.Test/JsonParserTest.cs
  2. 2
      csharp/src/Google.Protobuf.Test/JsonTokenizerTest.cs
  3. 5
      csharp/src/Google.Protobuf/WritingPrimitives.cs

@ -551,6 +551,8 @@ namespace Google.Protobuf
}
[Test]
// Skip these test cases in .NET 5 because floating point parsing supports bigger values.
// These big values won't throw an error in the test.
#if !NET5_0
[TestCase("1.7977e308")]
[TestCase("-1.7977e308")]

@ -199,6 +199,8 @@ namespace Google.Protobuf
[TestCase("1e-")]
[TestCase("--")]
[TestCase("--1")]
// Skip these test cases in .NET 5 because floating point parsing supports bigger values.
// These big values won't throw an error in the test.
#if !NET5_0
[TestCase("-1.7977e308")]
[TestCase("1.7977e308")]

@ -213,6 +213,8 @@ namespace Google.Protobuf
}
}
// Calling this method with non-ASCII content will break.
// Content must be verified to be all ASCII before using this method.
private static void WriteAsciiStringToBuffer(Span<byte> buffer, ref WriterInternalState state, string value, int length)
{
ref char sourceChars = ref MemoryMarshal.GetReference(value.AsSpan());
@ -283,6 +285,9 @@ namespace Google.Protobuf
else
#endif
{
// Fallback to non-SIMD approach when SIMD is not available.
// This could happen either because the APIs are not available, or hardware doesn't support it.
// Processing 4 chars at a time in this fallback is still faster than casting one char at a time.
if (BitConverter.IsLittleEndian)
{
outputBuffer = (byte)value;

Loading…
Cancel
Save