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

Go to the source code of this file.

Functions

void ULtoxL (ULong *L, const ULong *bits, Long exp, int k)
 
int strtorxL (CONST char *s, char **sp, int rounding, void *L)
 

Function Documentation

◆ strtorxL()

int strtorxL ( CONST char *  s,
char **  sp,
int  rounding,
void *  L 
)

Definition at line 100 of file strtorxL.c.

102 {
103  static FPI fpi0 = {64, 1 - 16383 - 64 + 1, 32766 - 16383 - 64 + 1, 1, SI};
104  FPI *fpi, fpi1;
105  ULong bits[2];
106  Long exp;
107  int k;
108 
109  fpi = &fpi0;
110  if(rounding != FPI_Round_near)
111  {
112  fpi1 = fpi0;
113  fpi1.rounding = rounding;
114  fpi = &fpi1;
115  }
116  k = strtodg(s, sp, fpi, &exp, bits);
117  ULtoxL((ULong*)L, bits, exp, k);
118  return k;
119 }
#define fpi1
void ULtoxL(ULong *L, const ULong *bits, Long exp, int k)
Definition: strtorxL.c:57
#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 fpi1, FPI_Round_near, Long, SI, strtodg(), and ULtoxL().

◆ ULtoxL()

void ULtoxL ( ULong L,
const ULong bits,
Long  exp,
int  k 
)

Definition at line 57 of file strtorxL.c.

59 {
60  switch(k & STRTOG_Retmask)
61  {
62  case STRTOG_NoNumber:
63  case STRTOG_Zero:
64  L[0] = L[1] = L[2] = 0;
65  break;
66 
67  case STRTOG_Normal:
68  case STRTOG_Denormal:
69  case STRTOG_NaNbits:
70  L[_0] = (ULong)((exp + 0x3fff + 63) << 16);
71  L[_1] = bits[1];
72  L[_2] = bits[0];
73  break;
74 
75  case STRTOG_Infinite:
76  L[_0] = 0x7fff << 16;
77  L[_1] = L[_2] = 0;
78  break;
79 
80  case STRTOG_NaN:
81  L[0] = ld_QNAN0;
82  L[1] = ld_QNAN1;
83  L[2] = ld_QNAN2;
84  }
85  if(k & STRTOG_Neg)
86  {
87  {
88  L[_0] |= 0x80000000L;
89  }
90  }
91 }
unsigned Long ULong
Definition: gdtoa.h:41

References STRTOG_Denormal, STRTOG_Infinite, STRTOG_NaN, STRTOG_NaNbits, STRTOG_Neg, STRTOG_NoNumber, STRTOG_Normal, STRTOG_Retmask, and STRTOG_Zero.

Referenced by strtoIxL(), and strtorxL().