Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
strtopQ.c File Reference
#include "gdtoaimp.h"
Include dependency graph for strtopQ.c:

Go to the source code of this file.

Functions

int strtopQ (CONST char *s, char **sp, void *V)
 

Function Documentation

◆ strtopQ()

int strtopQ ( CONST char *  s,
char **  sp,
void *  V 
)

Definition at line 58 of file strtopQ.c.

60 {
61  static FPI fpi = {113, 1 - 16383 - 113 + 1, 32766 - 16383 - 113 + 1, 1, SI};
62  ULong bits[4];
63  Long exp;
64  int k;
65  ULong* L = (ULong*)V;
66 
67  k = strtodg(s, sp, &fpi, &exp, bits);
68  switch(k & STRTOG_Retmask)
69  {
70  case STRTOG_NoNumber:
71  case STRTOG_Zero:
72  L[0] = L[1] = L[2] = L[3] = 0;
73  break;
74 
75  case STRTOG_Normal:
76  case STRTOG_NaNbits:
77  L[_3] = bits[0];
78  L[_2] = bits[1];
79  L[_1] = bits[2];
80  L[_0] = (bits[3] & (unsigned)~0x10000) | (unsigned)((exp + 0x3fff + 112) << 16);
81  break;
82 
83  case STRTOG_Denormal:
84  L[_3] = bits[0];
85  L[_2] = bits[1];
86  L[_1] = bits[2];
87  L[_0] = bits[3];
88  break;
89 
90  case STRTOG_Infinite:
91  L[_0] = 0x7fff0000;
92  L[_1] = L[_2] = L[_3] = 0;
93  break;
94 
95  case STRTOG_NaN:
96  L[0] = ld_QNAN0;
97  L[1] = ld_QNAN1;
98  L[2] = ld_QNAN2;
99  L[3] = ld_QNAN3;
100  }
101  if(k & STRTOG_Neg)
102  {
103  {
104  L[_0] |= 0x80000000L;
105  }
106  }
107  return k;
108 }
#define SI
Definition: gdtoaimp.h:635
unsigned Long ULong
Definition: gdtoa.h:41
Definition: gdtoa.h:86
#define Long
Definition: gdtoa.h:38
int strtodg(CONST char *s00, char **se, FPI *fpi, Long *exp, ULong *bits)
Definition: strtodg.c:443

References Long, SI, strtodg(), STRTOG_Denormal, STRTOG_Infinite, STRTOG_NaN, STRTOG_NaNbits, STRTOG_Neg, STRTOG_NoNumber, STRTOG_Normal, STRTOG_Retmask, and STRTOG_Zero.