diff --git a/src/libraries/System.Private.CoreLib/src/System/Boolean.cs b/src/libraries/System.Private.CoreLib/src/System/Boolean.cs index 07db907c2b1ed3..6869de20000279 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Boolean.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Boolean.cs @@ -96,22 +96,17 @@ public bool TryFormat(Span destination, out int charsWritten) { if (m_value) { - if (destination.Length > 3) + if (TrueLiteral.TryCopyTo(destination)) { - ulong true_val = BitConverter.IsLittleEndian ? 0x65007500720054ul : 0x54007200750065ul; // "True" - MemoryMarshal.Write(MemoryMarshal.AsBytes(destination), in true_val); - charsWritten = 4; + charsWritten = TrueLiteral.Length; return true; } } else { - if (destination.Length > 4) + if (FalseLiteral.TryCopyTo(destination)) { - ulong fals_val = BitConverter.IsLittleEndian ? 0x73006C00610046ul : 0x460061006C0073ul; // "Fals" - MemoryMarshal.Write(MemoryMarshal.AsBytes(destination), in fals_val); - destination[4] = 'e'; - charsWritten = 5; + charsWritten = FalseLiteral.Length; return true; } }