From: Stephen Toub Date: Thu, 15 Jun 2017 20:14:32 +0000 (-0400) Subject: Small cleanup to Char.IsWhiteSpaceLatin1 X-Git-Tag: submit/tizen/20210909.063632~11030^2~6925^2~418^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e165e7a19b000b336239f96d89ae71ccf63b1573;p=platform%2Fupstream%2Fdotnet%2Fruntime.git 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 --- 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===================================