diff options
| author | Kenichi Handa | 2004-01-29 02:55:34 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-01-29 02:55:34 +0000 |
| commit | 95ac7579e96df13405933715ac63cb489fcf0d0f (patch) | |
| tree | 42936d951280486a21938cfaccece5e0ca54e47d | |
| parent | 82450b416ded582986af7e92329efea77589670c (diff) | |
| download | emacs-95ac7579e96df13405933715ac63cb489fcf0d0f.tar.gz emacs-95ac7579e96df13405933715ac63cb489fcf0d0f.zip | |
(string_char_to_byte): Optimize for ASCII only string.
(string_byte_to_char): Likewise.
| -rw-r--r-- | src/fns.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -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 | { |