diff options
| author | Paul Eggert | 2017-07-05 17:51:31 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-07-05 18:59:31 -0700 |
| commit | d6662694d05be03fdd070353637dd22a324c8b7a (patch) | |
| tree | 3823cc192290478c041db63121c88afebfccbc13 /src/editfns.c | |
| parent | 24faf6b0d2fe990e9334dd2e3238f749fec87897 (diff) | |
| download | emacs-d6662694d05be03fdd070353637dd22a324c8b7a.tar.gz emacs-d6662694d05be03fdd070353637dd22a324c8b7a.zip | |
Convert hex digits more systematically
This makes the code a bit smaller and presumably faster, as
it substitutes a single lookup for conditional jumps.
* src/character.c (hexdigit): New constant.
(syms_of_character) [HEXDIGIT_IS_CONST]: Initialize it.
* src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): New macros.
(hexdigit): New decl.
(char_hexdigit): New inline function.
* src/charset.c: Do not include c-ctype.h.
* src/charset.c (read_hex):
* src/editfns.c (styled_format):
* src/image.c (xbm_scan):
* src/lread.c (read_escape):
* src/regex.c (ISXDIGIT) [emacs]:
Use char_hexdigit insted of doing it by hand.
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/editfns.c b/src/editfns.c index da99c055b54..d599fcfec80 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -4704,10 +4704,8 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message) | |||
| 4704 | char src0 = src[0]; | 4704 | char src0 = src[0]; |
| 4705 | int exponent_bytes = 0; | 4705 | int exponent_bytes = 0; |
| 4706 | bool signedp = src0 == '-' || src0 == '+' || src0 == ' '; | 4706 | bool signedp = src0 == '-' || src0 == '+' || src0 == ' '; |
| 4707 | if (zero_flag | 4707 | unsigned char after_sign = src[signedp]; |
| 4708 | && ((src[signedp] >= '0' && src[signedp] <= '9') | 4708 | if (zero_flag && 0 <= char_hexdigit (after_sign)) |
| 4709 | || (src[signedp] >= 'a' && src[signedp] <= 'f') | ||
| 4710 | || (src[signedp] >= 'A' && src[signedp] <= 'F'))) | ||
| 4711 | { | 4709 | { |
| 4712 | leading_zeros += padding; | 4710 | leading_zeros += padding; |
| 4713 | padding = 0; | 4711 | padding = 0; |