From e165e7a19b000b336239f96d89ae71ccf63b1573 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Thu, 15 Jun 2017 16:14:32 -0400 Subject: [PATCH] Small cleanup to Char.IsWhiteSpaceLatin1 For some reason this is resulting in measurably better throughput, in particular for non-whitespace chars, so much so that it's visible in microbenchmarks against string.IsNullOrWhiteSpace. If nothing else, it's cleaner. Commit migrated from https://github.com/dotnet/coreclr/commit/2f05efea2ea9e9c9e1ee9772a9da5fae4ca76ad7 --- src/coreclr/src/mscorlib/shared/System/Char.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/coreclr/src/mscorlib/shared/System/Char.cs b/src/coreclr/src/mscorlib/shared/System/Char.cs index 7244176..a5a3f7b 100644 --- a/src/coreclr/src/mscorlib/shared/System/Char.cs +++ b/src/coreclr/src/mscorlib/shared/System/Char.cs @@ -274,11 +274,7 @@ namespace System // U+000d = CARRIAGE RETURN // U+0085 = NEXT LINE // U+00a0 = NO-BREAK SPACE - if ((c == ' ') || (c >= '\x0009' && c <= '\x000d') || c == '\x00a0' || c == '\x0085') - { - return (true); - } - return (false); + return c == ' ' || (c >= '\x0009' && c <= '\x000d') || c == '\x00a0' || c == '\x0085'; } /*===============================ISWHITESPACE=================================== -- 2.7.4