diff src/fns.c @ 53742:2b23252ecc55

(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:53:53 +0000
parents 206ba2723812
children 9ddd570ce8c7
line wrap: on
line diff
--- 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))
     {