Branch: Tag:

1999-02-27

1999-02-27 20:36:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added strtod_pcharp().

Rev: src/stuff.c:1.7
Rev: src/stuff.h:1.6

5:   \*/      /* -  * $Id: stuff.c,v 1.6 1998/03/28 15:04:29 grubba Exp $ +  * $Id: stuff.c,v 1.7 1999/02/27 20:35:34 grubba Exp $    */   #include "stuff.h"   
123:    }    return tmp;   } +  + double strtod_pcharp(PCHARP ptr, PCHARP *endptr) + { +  /* NOTE: Cuts at 63 digits */ +  +  char buff[64]; +  int i; +  double res; +  char *end_; +  +  endptr->shift = ptr.shift; +  +  if (!ptr.shift) { +  return my_strtod(ptr.ptr, &endptr->ptr); +  } +  +  for (i=0; i < 63; i++) { +  unsigned int c = INDEX_PCHARP(ptr, i); +  if (!c || (c >= 256)) { +  break; +  } +  buff[i] = c; +  } +  buff[i] = 0; +  +  res = my_strtod(buff, &end_); +  +  endptr->ptr = ptr.ptr + ((end_ - buff)<<SHIFT); +  return res; + }