Changeset View
Changeset View
Standalone View
Standalone View
head/lib/msun/src/s_nan.c
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | _scan_nan(uint32_t *words, int num_words, const char *s) | ||||
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(s[si]); si++) | ||||
; | ; | ||||
/* 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 | |||||
for (bitpos = 0; bitpos < 32 * num_words; bitpos += 4) { | for (bitpos = 0; bitpos < 32 * num_words; bitpos += 4) { | ||||
#else | |||||
for (bitpos = 32 * num_words - 4; bitpos >= 0; bitpos -= 4) { | |||||
#endif | |||||
if (--si < 0) | if (--si < 0) | ||||
break; | break; | ||||
#if _BYTE_ORDER == _LITTLE_ENDIAN | |||||
words[bitpos / 32] |= digittoint(s[si]) << (bitpos % 32); | words[bitpos / 32] |= digittoint(s[si]) << (bitpos % 32); | ||||
#else | |||||
words[num_words - 1 - bitpos / 32] |= | |||||
digittoint(s[si]) << (bitpos % 32); | |||||
#endif | |||||
} | } | ||||
} | } | ||||
double | double | ||||
nan(const char *s) | nan(const char *s) | ||||
{ | { | ||||
union { | union { | ||||
double d; | double d; | ||||
Show All 28 Lines |