changeset 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 65b9f657ba94
children 30797cf81519
files src/fns.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
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))
     {