Workaround to remove unnecessary bounds checks when using {ReadOnly}Span.IsEmpty...
authorAhson Khan <ahkha@microsoft.com>
Fri, 24 Aug 2018 02:11:48 +0000 (19:11 -0700)
committerGitHub <noreply@github.com>
Fri, 24 Aug 2018 02:11:48 +0000 (19:11 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/3ce59b1ab67fcf7c23c9fbc5da9b229f54568414

src/libraries/System.Private.CoreLib/src/System/ReadOnlySpan.cs
src/libraries/System.Private.CoreLib/src/System/Span.cs

index 61af717..17b7134 100644 (file)
@@ -40,7 +40,8 @@ namespace System
             [NonVersionable]
             get
             {
-                return _length == 0;
+                // Workaround for https://github.com/dotnet/coreclr/issues/19620
+                return 0 >= (uint)_length;
             }
         }
         /// <summary>
index ddbdba1..185042f 100644 (file)
@@ -40,7 +40,8 @@ namespace System
             [NonVersionable]
             get
             {
-                return _length == 0;
+                // Workaround for https://github.com/dotnet/coreclr/issues/19620
+                return 0 >= (uint)_length;
             }
         }