Mercurial > emacs
changeset 89783:ef4f64e8e503
(string_char_to_byte): Optimize for ASCII only string.
(string_byte_to_char): Likewise.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 29 Jan 2004 02:55:34 +0000 |
parents | ce852d289e01 |
children | 4afbf3431108 |
files | src/fns.c |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fns.c Thu Jan 29 01:27:24 2004 +0000 +++ b/src/fns.c Thu Jan 29 02:55:34 2004 +0000 @@ -810,12 +810,11 @@ int best_below, best_below_byte; int best_above, best_above_byte; - if (! STRING_MULTIBYTE (string)) - return char_index; - best_below = best_below_byte = 0; best_above = SCHARS (string); best_above_byte = SBYTES (string); + if (best_above == best_above_byte) + return char_index; if (EQ (string, string_char_byte_cache_string)) { @@ -873,12 +872,11 @@ int best_below, best_below_byte; int best_above, best_above_byte; - if (! STRING_MULTIBYTE (string)) - return byte_index; - best_below = best_below_byte = 0; best_above = SCHARS (string); best_above_byte = SBYTES (string); + if (best_above == best_above_byte) + return byte_index; if (EQ (string, string_char_byte_cache_string)) {