# HG changeset patch # User Kenichi Handa # Date 1075344833 0 # Node ID 2b23252ecc555a0a4289af372eb479ed4d441753 # Parent 65b9f657ba94161cda3f26986a7178e0041463e1 (string_char_to_byte): Optimize for ASCII only string. (string_byte_to_char): Likewise. diff -r 65b9f657ba94 -r 2b23252ecc55 src/fns.c --- a/src/fns.c Wed Jan 28 23:33:32 2004 +0000 +++ b/src/fns.c Thu Jan 29 02:53:53 2004 +0000 @@ -884,12 +884,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)) { @@ -957,12 +956,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)) {