diff --git a/src/libraries/Common/src/System/Number.NumberBuffer.cs b/src/libraries/Common/src/System/Number.NumberBuffer.cs index f877d3b7298969..44c1d47d96dcab 100644 --- a/src/libraries/Common/src/System/Number.NumberBuffer.cs +++ b/src/libraries/Common/src/System/Number.NumberBuffer.cs @@ -29,9 +29,8 @@ internal unsafe ref struct NumberBuffer public bool IsNegative; public bool HasNonZeroTail; public NumberBufferKind Kind; - public byte* DigitsPtr; - public int DigitsLength; - public readonly Span Digits => new Span(DigitsPtr, DigitsLength); + public Span Digits; + public readonly byte* DigitsPtr => (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(Digits)); // safe since constructor expects Digits to refer to unmovable memory public NumberBuffer(NumberBufferKind kind, byte* digits, int digitsLength) : this(kind, new Span(digits, digitsLength)) { @@ -50,8 +49,7 @@ public NumberBuffer(NumberBufferKind kind, Span digits) IsNegative = false; HasNonZeroTail = false; Kind = kind; - DigitsPtr = (byte*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(digits)); // Safe since memory must be fixed - DigitsLength = digits.Length; + Digits = digits; #if DEBUG Digits.Fill(0xCC); #endif