2 * hextolfp - convert an ascii hex string to an l_fp number
8 #include "ntp_string.h"
9 #include "ntp_stdlib.h"
17 register const char *cp;
18 register const char *cpstart;
19 register u_long dec_i;
20 register u_long dec_f;
22 static const char *digits = "0123456789abcdefABCDEF";
28 * We understand numbers of the form:
30 * [spaces]8_hex_digits[.]8_hex_digits[spaces|\n|\0]
32 while (isspace((int)*cp))
36 while (*cp != '\0' && (cp - cpstart) < 8 &&
37 (ind = strchr(digits, *cp)) != NULL) {
38 dec_i = dec_i << 4; /* multiply by 16 */
39 dec_i += ((ind - digits) > 15) ? (ind - digits) - 6
44 if ((cp - cpstart) < 8 || ind == NULL)
50 while (*cp != '\0' && (cp - cpstart) < 8 &&
51 (ind = strchr(digits, *cp)) != NULL) {
52 dec_f = dec_f << 4; /* multiply by 16 */
53 dec_f += ((ind - digits) > 15) ? (ind - digits) - 6
58 if ((cp - cpstart) < 8 || ind == NULL)
61 if (*cp != '\0' && !isspace((int)*cp))