diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/StandardFormat.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/StandardFormat.cs index 24a49838308d76..56fe48f1b93cea 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/StandardFormat.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/StandardFormat.cs @@ -52,7 +52,9 @@ namespace System.Buffers /// An optional precision ranging from 0..9 or the special value NoPrecision (the default) public StandardFormat(char symbol, byte precision = NoPrecision) { - if (precision != NoPrecision && precision > MaxPrecision) + // Optimized version of "precision != NoPrecision && precision > MaxPrecision" + // it makes StandardFormat inlinenable + if ((byte)(precision - (MaxPrecision + 1)) < (NoPrecision - (MaxPrecision + 1))) ThrowHelper.ThrowArgumentOutOfRangeException_PrecisionTooLarge(); if (symbol != (byte)symbol) ThrowHelper.ThrowArgumentOutOfRangeException_SymbolDoesNotFit();