mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-28 00:01:33 -08:00
(decode_coding_utf_8): Add simple loop for fast processing of ASCII characters.
This commit is contained in:
parent
8ba8eec59b
commit
a1aeeffedd
2 changed files with 44 additions and 0 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2013-07-19 Richard Stallman <rms@gnu.org>
|
||||
|
||||
* coding.c (decode_coding_utf_8): Add simple loop for fast
|
||||
processing of ASCII characters.
|
||||
|
||||
2013-07-19 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* conf_post.h (RE_TRANSLATE_P) [emacs]: Remove obsolete optimization.
|
||||
|
|
|
|||
39
src/coding.c
39
src/coding.c
|
|
@ -1363,6 +1363,45 @@ decode_coding_utf_8 (struct coding_system *coding)
|
|||
break;
|
||||
}
|
||||
|
||||
/* In the simple case, rapidly handle ordinary characters */
|
||||
if (multibytep && ! eol_dos
|
||||
&& charbuf < charbuf_end - 6 && src < src_end - 6)
|
||||
{
|
||||
while (charbuf < charbuf_end - 6 && src < src_end - 6)
|
||||
{
|
||||
c1 = *src;
|
||||
if (c1 & 0x80)
|
||||
break;
|
||||
src++;
|
||||
consumed_chars++;
|
||||
*charbuf++ = c1;
|
||||
|
||||
c1 = *src;
|
||||
if (c1 & 0x80)
|
||||
break;
|
||||
src++;
|
||||
consumed_chars++;
|
||||
*charbuf++ = c1;
|
||||
|
||||
c1 = *src;
|
||||
if (c1 & 0x80)
|
||||
break;
|
||||
src++;
|
||||
consumed_chars++;
|
||||
*charbuf++ = c1;
|
||||
|
||||
c1 = *src;
|
||||
if (c1 & 0x80)
|
||||
break;
|
||||
src++;
|
||||
consumed_chars++;
|
||||
*charbuf++ = c1;
|
||||
}
|
||||
/* If we handled at least one character, restart the main loop. */
|
||||
if (src != src_base)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (byte_after_cr >= 0)
|
||||
c1 = byte_after_cr, byte_after_cr = -1;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue