From: Ahson Khan Date: Fri, 24 Aug 2018 02:11:48 +0000 (-0700) Subject: Workaround to remove unnecessary bounds checks when using {ReadOnly}Span.IsEmpty... X-Git-Tag: accepted/tizen/unified/20190422.045933~1374 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ce59b1ab67fcf7c23c9fbc5da9b229f54568414;p=platform%2Fupstream%2Fcoreclr.git Workaround to remove unnecessary bounds checks when using {ReadOnly}Span.IsEmpty (#19640) --- diff --git a/src/System.Private.CoreLib/shared/System/ReadOnlySpan.cs b/src/System.Private.CoreLib/shared/System/ReadOnlySpan.cs index 61af717..17b7134 100644 --- a/src/System.Private.CoreLib/shared/System/ReadOnlySpan.cs +++ b/src/System.Private.CoreLib/shared/System/ReadOnlySpan.cs @@ -40,7 +40,8 @@ namespace System [NonVersionable] get { - return _length == 0; + // Workaround for https://github.com/dotnet/coreclr/issues/19620 + return 0 >= (uint)_length; } } /// diff --git a/src/System.Private.CoreLib/shared/System/Span.cs b/src/System.Private.CoreLib/shared/System/Span.cs index ddbdba1..185042f 100644 --- a/src/System.Private.CoreLib/shared/System/Span.cs +++ b/src/System.Private.CoreLib/shared/System/Span.cs @@ -40,7 +40,8 @@ namespace System [NonVersionable] get { - return _length == 0; + // Workaround for https://github.com/dotnet/coreclr/issues/19620 + return 0 >= (uint)_length; } }