[BACK]Return to s_nan.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libm / src

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/lib/libm/src/s_nan.c between version 1.1 and 1.2

version 1.1, 2013/02/09 19:37:48 version 1.2, 2013/02/09 20:19:13
Line 35  __RCSID("$NetBSD$");
Line 35  __RCSID("$NetBSD$");
 #include <float.h>  #include <float.h>
 #include <math.h>  #include <math.h>
 #include <stdint.h>  #include <stdint.h>
 #include <strings.h>  #include <string.h>
   
 #include "math_private.h"  #include "math_private.h"
   
   /* XXX: Locale? not here? in <ctype.h>? */
   static int
   digittoint(char s) {
           if (isdigit((unsigned char)s))
                   return s - '0';
           if (islower((unsigned char)s))
                   return s - 'a' + 10;
           return s - 'A' + 10;
   }
   
 /*  /*
  * Scan a string of hexadecimal digits (the format nan(3) expects) and   * Scan a string of hexadecimal digits (the format nan(3) expects) and
  * make a bit array (using the local endianness). We stop when we   * make a bit array (using the local endianness). We stop when we
Line 51  __RCSID("$NetBSD$");
Line 61  __RCSID("$NetBSD$");
  * consider valid, so we might be violating the C standard. But it's   * consider valid, so we might be violating the C standard. But it's
  * impossible to use nan(3) portably anyway, so this seems good enough.   * impossible to use nan(3) portably anyway, so this seems good enough.
  */   */
 void  static void
 _scan_nan(uint32_t *words, int num_words, const char *s)  _scan_nan(uint32_t *words, int num_words, const char *s)
 {  {
         int si;         /* index into s */          int si;         /* index into s */
         int bitpos;     /* index into words (in bits) */          int bitpos;     /* index into words (in bits) */
   
         bzero(words, num_words * sizeof(uint32_t));          memset(words, 0, num_words * sizeof(*words));
   
         /* Allow a leading '0x'. (It's expected, but redundant.) */          /* Allow a leading '0x'. (It's expected, but redundant.) */
         if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))          if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
                 s += 2;                  s += 2;
   
         /* Scan forwards in the string, looking for the end of the sequence. */          /* Scan forwards in the string, looking for the end of the sequence. */
         for (si = 0; isxdigit(s[si]); si++)          for (si = 0; isxdigit((unsigned char)s[si]); si++)
                 ;                  continue;
   
         /* Scan backwards, filling in the bits in words[] as we go. */          /* Scan backwards, filling in the bits in words[] as we go. */
 #if _BYTE_ORDER == _LITTLE_ENDIAN  #if _BYTE_ORDER == _LITTLE_ENDIAN

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

CVSweb <webmaster@jp.NetBSD.org>