Speedup Char::IsWhiteSpace
[mono.git] / mcs / class / corlib / System / Char.cs
index 9503b2c33ac0ab911e2557a72099a6d19cae0775..baf83d60afb7e48aba37b22876191c185f1e8d16 100644 (file)
@@ -408,18 +408,16 @@ namespace System
                        CheckParameter (s, index);
                        return IsUpper (s[index]);
                }
-
+               
+//             [MethodImpl (MethodImplOptions.AggressiveInlining)]
                public static bool IsWhiteSpace (char c)
                {
+                       if (c < 0x1680)
+                               return c == 0x20 || c >= 0x09 && c <= 0x0d || c == 0x85 || c == 0xA0;
+
                        unsafe {
                                int category = category_data [c];
-                               if (category <= ((int)UnicodeCategory.OtherNumber))
-                                       return false;
-                               if (category <= ((int)UnicodeCategory.ParagraphSeparator))
-                                       return true;
-                               // FIXME: (char)0x205F Medium Mathematical Space has wrong category in 2.0 Profile
-                               // Remove the if NET_2_0 case once the error is corrected
-                               return  c >= (char)0x09 && c <= (char)0x0d || c == (char)0x85 || c == (char)0x205F;
+                               return category > (int) UnicodeCategory.OtherNumber && category <= (int) UnicodeCategory.ParagraphSeparator;
                        }
                }