/* convert an hexadecimal numeric string to a number, following C99 specification for 'strtod'  */
static lua_Number lua_strx2number(const char *s, char **endptr)
/* convert an hexadecimal numeric string to a number, following C99 specification for 'strtod'  */
static lua_Number lua_strx2number(const char *s, char **endptr)
{
    s++;
    r = readhexa(&s, r, &e);
  }
  if (i == 0 && e == 0)
    return 0.0;
  e *= -4;
  *endptr = cast(char *, s);
  if (*s == 'p' || *s == 'P') {
    int exp1 = 0;
    int neg1;
    s++;
    neg1 = isneg(&s);
    if (!lisdigit(cast_uchar(*s)))
      goto ret;
    while (lisdigit(cast_uchar(*s)))
      exp1 = exp1 * 10 + *(s++) - '0';
    if (neg1) exp1 = -exp1;
    e += exp1;
  }
  *endptr = cast(char *, s);
 ret:
  if (neg) r = -r;
  return l_mathop(ldexp)(r, e);
}