Skip to content

Commit 9ceacaf

Browse files
andrewlockclaude
andcommitted
Unify CharToHexLookup as ReadOnlySpan<byte>
Now that Span<T>/ReadOnlySpan<T> live in the System namespace on all TFMs, the RVA-backed `static ReadOnlySpan<byte> Prop => new byte[] {...}` idiom compiles correctly on net461/netstandard2.0 too. Collapse the NETCOREAPP / net461 ifdef around CharToHexLookup into a single ReadOnlySpan<byte> property and drop the now-unused SA1201 pragma block. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3827c43 commit 9ceacaf

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

tracer/src/Datadog.Trace/Util/HexConverter.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ public enum Casing : uint
3535
/// <summary>
3636
/// Gets a map from an ASCII char to its hex value, e.g. arr['b'] == 11. 0xFF means it's not a hex digit.
3737
/// </summary>
38-
#if NETCOREAPP
3938
private static ReadOnlySpan<byte> CharToHexLookup =>
40-
#else
41-
#pragma warning disable SA1201 // Elements should appear in the correct order
42-
private static readonly byte[] CharToHexLookup =
43-
#pragma warning restore SA1201 // Elements should appear in the correct order
44-
#endif
4539
[
4640
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 15
4741
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 31

0 commit comments

Comments
 (0)