diff options
author | Kenneth G Raeburn <raeburn@mit.edu> | 1990-12-12 04:31:27 +0000 |
---|---|---|
committer | Kenneth G Raeburn <raeburn@mit.edu> | 1990-12-12 04:31:27 +0000 |
commit | 1cb73bcf1aed0348296a0add0170ca506c93ede0 (patch) | |
tree | f9b01ea58ffcae723df46318ae1adcdf13b0d31d | |
parent | 3006d8bb3fac2fbca4f368b44c4cd5dd4c47dac6 (diff) |
Converted z_cnvt_xtoi to a macro for speed.
-rw-r--r-- | lib/ZReadAscii.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/ZReadAscii.c b/lib/ZReadAscii.c index aee3a78..7c7ce5d 100644 --- a/lib/ZReadAscii.c +++ b/lib/ZReadAscii.c @@ -25,13 +25,10 @@ static #include <zephyr/zephyr_internal.h> -static int -#ifdef __STDC__ -Z_cnvt_xtoi (char c) /* may be faster */ -#else -Z_cnvt_xtoi(c) - char c; -#endif +#if 0 +static __inline__ +int +Z_cnvt_xtoi (char c) { c -= '0'; if (c < 10) @@ -41,6 +38,9 @@ Z_cnvt_xtoi(c) return c; return -1; } +#endif + +#define Z_cnvt_xtoi(c) ((temp=(c)-'0'),(temp<10)?temp:((temp-='A'-'9'-1),(temp<16)?temp:-1)) int ZReadAscii(ptr, len, field, num) char *ptr; @@ -51,6 +51,9 @@ int ZReadAscii(ptr, len, field, num) int i; unsigned int hexbyte; register char c1, c2; +#ifdef Z_cnvt_xtoi + register unsigned int temp; +#endif for (i=0;i<num;i++) { if (*ptr == ' ') { |