Author: atsushi
Date: 2006-01-24 08:49:01 -0500 (Tue, 24 Jan 2006)
New Revision: 55981
Modified:
trunk/mcs/class/corlib/System.Text/ChangeLog
trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs
Log:
2006-01-24 Atsushi Enomoto <[EMAIL PROTECTED]>
* UTF8Encoding.cs : InternalGetCharCount() optimization: fast path
for ASCII range.
Modified: trunk/mcs/class/corlib/System.Text/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Text/ChangeLog 2006-01-24 12:36:13 UTC
(rev 55980)
+++ trunk/mcs/class/corlib/System.Text/ChangeLog 2006-01-24 13:49:01 UTC
(rev 55981)
@@ -1,5 +1,10 @@
2006-01-24 Atsushi Enomoto <[EMAIL PROTECTED]>
+ * UTF8Encoding.cs : InternalGetCharCount() optimization: fast path
+ for ASCII range.
+
+2006-01-24 Atsushi Enomoto <[EMAIL PROTECTED]>
+
* UTF7Encoding.cs UTF8Encoding.cs :
Fixed bug #77315 (Patch by [EMAIL PROTECTED]).
Make strict check for invalid surrogate.
Modified: trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs
===================================================================
--- trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs 2006-01-24 12:36:13 UTC
(rev 55980)
+++ trunk/mcs/class/corlib/System.Text/UTF8Encoding.cs 2006-01-24 13:49:01 UTC
(rev 55981)
@@ -394,6 +394,14 @@
throw new ArgumentOutOfRangeException ("count",
_("ArgRange_Array"));
}
+ // fast path for ASCII range
+ for (int end = index + count; index < end; count--) {
+ if (bytes [index] < 0x80)
+ index++;
+ else
+ break;
+ }
+
// Determine the number of characters that we have.
uint ch;
int length = 0;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches