# HG changeset patch # User Kenichi Handa # Date 1075344934 0 # Node ID ef4f64e8e503daac22f1017cee0e9fe87fd8658f # Parent ce852d289e016b615b7c5b0f30c90c16b0513be3 (string_char_to_byte): Optimize for ASCII only string. (string_byte_to_char): Likewise. diff -r ce852d289e01 -r ef4f64e8e503 src/fns.c --- 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)) {