Mercurial > emacs
comparison 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 |
comparison
equal
deleted
inserted
replaced
53741:65b9f657ba94 | 53742:2b23252ecc55 |
---|---|
882 { | 882 { |
883 int i, i_byte; | 883 int i, i_byte; |
884 int best_below, best_below_byte; | 884 int best_below, best_below_byte; |
885 int best_above, best_above_byte; | 885 int best_above, best_above_byte; |
886 | 886 |
887 if (! STRING_MULTIBYTE (string)) | |
888 return char_index; | |
889 | |
890 best_below = best_below_byte = 0; | 887 best_below = best_below_byte = 0; |
891 best_above = SCHARS (string); | 888 best_above = SCHARS (string); |
892 best_above_byte = SBYTES (string); | 889 best_above_byte = SBYTES (string); |
890 if (best_above == best_above_byte) | |
891 return char_index; | |
893 | 892 |
894 if (EQ (string, string_char_byte_cache_string)) | 893 if (EQ (string, string_char_byte_cache_string)) |
895 { | 894 { |
896 if (string_char_byte_cache_charpos < char_index) | 895 if (string_char_byte_cache_charpos < char_index) |
897 { | 896 { |
955 { | 954 { |
956 int i, i_byte; | 955 int i, i_byte; |
957 int best_below, best_below_byte; | 956 int best_below, best_below_byte; |
958 int best_above, best_above_byte; | 957 int best_above, best_above_byte; |
959 | 958 |
960 if (! STRING_MULTIBYTE (string)) | |
961 return byte_index; | |
962 | |
963 best_below = best_below_byte = 0; | 959 best_below = best_below_byte = 0; |
964 best_above = SCHARS (string); | 960 best_above = SCHARS (string); |
965 best_above_byte = SBYTES (string); | 961 best_above_byte = SBYTES (string); |
962 if (best_above == best_above_byte) | |
963 return byte_index; | |
966 | 964 |
967 if (EQ (string, string_char_byte_cache_string)) | 965 if (EQ (string, string_char_byte_cache_string)) |
968 { | 966 { |
969 if (string_char_byte_cache_bytepos < byte_index) | 967 if (string_char_byte_cache_bytepos < byte_index) |
970 { | 968 { |