aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2004-01-29 02:55:34 +0000
committerKenichi Handa2004-01-29 02:55:34 +0000
commit95ac7579e96df13405933715ac63cb489fcf0d0f (patch)
tree42936d951280486a21938cfaccece5e0ca54e47d /src
parent82450b416ded582986af7e92329efea77589670c (diff)
downloademacs-95ac7579e96df13405933715ac63cb489fcf0d0f.tar.gz
emacs-95ac7579e96df13405933715ac63cb489fcf0d0f.zip
(string_char_to_byte): Optimize for ASCII only string.
(string_byte_to_char): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/fns.c b/src/fns.c
index fa99293fcce..ea45b9d8dbb 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -810,12 +810,11 @@ string_char_to_byte (string, char_index)
810 int best_below, best_below_byte; 810 int best_below, best_below_byte;
811 int best_above, best_above_byte; 811 int best_above, best_above_byte;
812 812
813 if (! STRING_MULTIBYTE (string))
814 return char_index;
815
816 best_below = best_below_byte = 0; 813 best_below = best_below_byte = 0;
817 best_above = SCHARS (string); 814 best_above = SCHARS (string);
818 best_above_byte = SBYTES (string); 815 best_above_byte = SBYTES (string);
816 if (best_above == best_above_byte)
817 return char_index;
819 818
820 if (EQ (string, string_char_byte_cache_string)) 819 if (EQ (string, string_char_byte_cache_string))
821 { 820 {
@@ -873,12 +872,11 @@ string_byte_to_char (string, byte_index)
873 int best_below, best_below_byte; 872 int best_below, best_below_byte;
874 int best_above, best_above_byte; 873 int best_above, best_above_byte;
875 874
876 if (! STRING_MULTIBYTE (string))
877 return byte_index;
878
879 best_below = best_below_byte = 0; 875 best_below = best_below_byte = 0;
880 best_above = SCHARS (string); 876 best_above = SCHARS (string);
881 best_above_byte = SBYTES (string); 877 best_above_byte = SBYTES (string);
878 if (best_above == best_above_byte)
879 return byte_index;
882 880
883 if (EQ (string, string_char_byte_cache_string)) 881 if (EQ (string, string_char_byte_cache_string))
884 { 882 {