Embedded Artistry libc
C Standard Library Support for Bare-metal Systems
gdtoaimp.h File Reference
#include "gd_qnan.h"
#include "gdtoa.h"
#include "stdlib.h"
#include "string.h"
#include "errno.h"
#include "float.h"
#include "math.h"
Include dependency graph for gdtoaimp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  U
 
struct  Bigint
 

Macros

#define Char   void
 
#define MALLOC   malloc
 
#define word0(x)   ((U*)&x)->L[0]
 
#define word1(x)   ((U*)&x)->L[1]
 
#define dval(x)   ((U*)&x)->d
 
#define Storeinc(a, b, c)   (((unsigned short*)a)[0] = (unsigned short)b, ((unsigned short*)a)[1] = (unsigned short)c, a++)
 
#define Sudden_Underflow
 
#define Flt_Rounds   1
 
#define Exp_shift   23
 
#define Exp_shift1   7
 
#define Exp_msk1   0x80
 
#define Exp_msk11   0x800000
 
#define Exp_mask   0x7f80
 
#define P   56
 
#define Bias   129
 
#define Exp_1   0x40800000
 
#define Exp_11   0x4080
 
#define Ebits   8
 
#define Frac_mask   0x7fffff
 
#define Frac_mask1   0xffff007f
 
#define Ten_pmax   24
 
#define Bletch   2
 
#define Bndry_mask   0xffff007f
 
#define Bndry_mask1   0xffff007f
 
#define LSB   0x10000
 
#define Sign_bit   0x8000
 
#define Log2P   1
 
#define Tiny0   0x80
 
#define Tiny1   0
 
#define Quick_max   15
 
#define Int_max   15
 
#define ROUND_BIASED
 
#define rounded_product(a, b)   a *= b
 
#define rounded_quotient(a, b)   a /= b
 
#define Big0   (Frac_mask1 | Exp_msk1 * (DBL_MAX_EXP + Bias - 1))
 
#define Big1   0xffffffff
 
#define Pack_32
 
#define Llong   long long
 
#define ULLong   unsigned Llong
 
#define ULbits   32
 
#define kshift   5
 
#define kmask   31
 
#define ALL_ON   0xffffffff
 
#define ACQUIRE_DTOA_LOCK(n)   /*nothing*/
 
#define FREE_DTOA_LOCK(n)   /*nothing*/
 
#define Kmax   15
 
#define Bcopy(x, y)   memcpy(&x->sign, &y->sign, (size_t)(y->wds) * sizeof(ULong) + 2 * sizeof(int))
 
#define Balloc   Balloc_D2A
 
#define Bfree   Bfree_D2A
 
#define ULtoQ   ULtoQ_D2A
 
#define ULtof   ULtof_D2A
 
#define ULtod   ULtod_D2A
 
#define ULtodd   ULtodd_D2A
 
#define ULtox   ULtox_D2A
 
#define ULtoxL   ULtoxL_D2A
 
#define any_on   any_on_D2A
 
#define b2d   b2d_D2A
 
#define bigtens   bigtens_D2A
 
#define cmp   cmp_D2A
 
#define copybits   copybits_D2A
 
#define d2b   d2b_D2A
 
#define decrement   decrement_D2A
 
#define diff   diff_D2A
 
#define dtoa_result   dtoa_result_D2A
 
#define g__fmt   g__fmt_D2A
 
#define gethex   gethex_D2A
 
#define hexdig   hexdig_D2A
 
#define hexnan   hexnan_D2A
 
#define hi0bits(x)   hi0bits_D2A((ULong)(x))
 
#define i2b   i2b_D2A
 
#define increment   increment_D2A
 
#define lo0bits   lo0bits_D2A
 
#define lshift   lshift_D2A
 
#define match   match_D2A
 
#define mult   mult_D2A
 
#define multadd   multadd_D2A
 
#define nrv_alloc   nrv_alloc_D2A
 
#define pow5mult   pow5mult_D2A
 
#define quorem   quorem_D2A
 
#define ratio   ratio_D2A
 
#define rshift   rshift_D2A
 
#define rv_alloc   rv_alloc_D2A
 
#define s2b   s2b_D2A
 
#define set_ones   set_ones_D2A
 
#define strcp   strcp_D2A
 
#define strtoIg   strtoIg_D2A
 
#define sum   sum_D2A
 
#define tens   tens_D2A
 
#define tinytens   tinytens_D2A
 
#define tinytens   tinytens_D2A
 
#define trailz   trailz_D2A
 
#define ulp   ulp_D2A
 
#define SI   1
 

Typedefs

typedef struct Bigint Bigint
 

Functions

Bigint *Balloc ANSI ((int))
 
void Bfree ANSI ((Bigint *))
 
void ULtof ANSI ((ULong *, const ULong *, Long, int))
 
void ULtodd ANSI ((ULong *, ULong *, Long, int))
 
void ULtox ANSI ((UShort *, const ULong *, Long, int))
 
ULong any_on ANSI ((Bigint *, int))
 
double b2d ANSI ((Bigint *, int *))
 
int cmp ANSI ((Bigint *, Bigint *))
 
void copybits ANSI ((ULong *, int, Bigint *))
 
Bigint *d2b ANSI ((double, int *, int *))
 
char *dtoa ANSI ((double d, int mode, int ndigits, int *decpt, int *sign, char **rve))
 
char *g__fmt ANSI ((char *, char *, const char *, int, ULong))
 
int gethex ANSI ((CONST char **, FPI *, Long *, Bigint **, int))
 
void hexdig_init_D2A (Void)
 
int hexnan ANSI ((CONST char **, FPI *, ULong *))
 
int hi0bits_D2A ANSI ((ULong))
 
int lo0bits ANSI ((ULong *))
 
int match ANSI ((CONST char **, char *))
 
Bigint *multadd ANSI ((Bigint *, int, int))
 
char *nrv_alloc ANSI ((char *, char **, int))
 
Bigint *s2b ANSI ((CONST char *, int, int, ULong))
 
char *strcp ANSI ((char *, const char *))
 
int strtoIg ANSI ((CONST char *, char **, FPI *, Long *, Bigint **, int *))
 
double strtod ANSI ((const char *s00, char **se))
 
double ulp ANSI ((double))
 

Variables

Exactly one of IEEE_8087
 
Exactly one of IEEE_MC68k
 
Exactly one of VAX
 
char * dtoa_result
 
CONST double bigtens []
 
CONST double tens []
 
CONST double tinytens []
 
unsigned char hexdig []
 

Class Documentation

◆ U

union U

Definition at line 284 of file gdtoaimp.h.

Collaboration diagram for U:
Collaboration graph
Class Members
double d
ULong L[2]

◆ Bigint

struct Bigint

Definition at line 484 of file gdtoaimp.h.

Collaboration diagram for Bigint:
Collaboration graph
Class Members
int k
int maxwds
struct Bigint * next
int sign
int wds
ULong x[1]

Macro Definition Documentation

◆ ACQUIRE_DTOA_LOCK

#define ACQUIRE_DTOA_LOCK (   n)    /*nothing*/

Definition at line 478 of file gdtoaimp.h.

◆ ALL_ON

#define ALL_ON   0xffffffff

Definition at line 469 of file gdtoaimp.h.

◆ any_on

#define any_on   any_on_D2A

Definition at line 512 of file gdtoaimp.h.

◆ b2d

#define b2d   b2d_D2A

Definition at line 513 of file gdtoaimp.h.

◆ Balloc

#define Balloc   Balloc_D2A

Definition at line 504 of file gdtoaimp.h.

◆ Bcopy

#define Bcopy (   x,
 
)    memcpy(&x->sign, &y->sign, (size_t)(y->wds) * sizeof(ULong) + 2 * sizeof(int))

Definition at line 501 of file gdtoaimp.h.

◆ Bfree

#define Bfree   Bfree_D2A

Definition at line 505 of file gdtoaimp.h.

◆ Bias

#define Bias   129

Definition at line 400 of file gdtoaimp.h.

◆ Big0

#define Big0   (Frac_mask1 | Exp_msk1 * (DBL_MAX_EXP + Bias - 1))

Definition at line 437 of file gdtoaimp.h.

◆ Big1

#define Big1   0xffffffff

Definition at line 438 of file gdtoaimp.h.

◆ bigtens

#define bigtens   bigtens_D2A

Definition at line 514 of file gdtoaimp.h.

◆ Bletch

#define Bletch   2

Definition at line 407 of file gdtoaimp.h.

◆ Bndry_mask

#define Bndry_mask   0xffff007f

Definition at line 408 of file gdtoaimp.h.

◆ Bndry_mask1

#define Bndry_mask1   0xffff007f

Definition at line 409 of file gdtoaimp.h.

◆ Char

#define Char   void

Definition at line 200 of file gdtoaimp.h.

◆ cmp

#define cmp   cmp_D2A

Definition at line 515 of file gdtoaimp.h.

◆ copybits

#define copybits   copybits_D2A

Definition at line 516 of file gdtoaimp.h.

◆ d2b

#define d2b   d2b_D2A

Definition at line 517 of file gdtoaimp.h.

◆ decrement

#define decrement   decrement_D2A

Definition at line 518 of file gdtoaimp.h.

◆ diff

#define diff   diff_D2A

Definition at line 519 of file gdtoaimp.h.

◆ dtoa_result

#define dtoa_result   dtoa_result_D2A

Definition at line 520 of file gdtoaimp.h.

◆ dval

#define dval (   x)    ((U*)&x)->d

Definition at line 307 of file gdtoaimp.h.

◆ Ebits

#define Ebits   8

Definition at line 403 of file gdtoaimp.h.

◆ Exp_1

#define Exp_1   0x40800000

Definition at line 401 of file gdtoaimp.h.

◆ Exp_11

#define Exp_11   0x4080

Definition at line 402 of file gdtoaimp.h.

◆ Exp_mask

#define Exp_mask   0x7f80

Definition at line 398 of file gdtoaimp.h.

◆ Exp_msk1

#define Exp_msk1   0x80

Definition at line 396 of file gdtoaimp.h.

◆ Exp_msk11

#define Exp_msk11   0x800000

Definition at line 397 of file gdtoaimp.h.

◆ Exp_shift

#define Exp_shift   23

Definition at line 394 of file gdtoaimp.h.

◆ Exp_shift1

#define Exp_shift1   7

Definition at line 395 of file gdtoaimp.h.

◆ Flt_Rounds

#define Flt_Rounds   1

Definition at line 393 of file gdtoaimp.h.

◆ Frac_mask

#define Frac_mask   0x7fffff

Definition at line 404 of file gdtoaimp.h.

◆ Frac_mask1

#define Frac_mask1   0xffff007f

Definition at line 405 of file gdtoaimp.h.

◆ FREE_DTOA_LOCK

#define FREE_DTOA_LOCK (   n)    /*nothing*/

Definition at line 479 of file gdtoaimp.h.

◆ g__fmt

#define g__fmt   g__fmt_D2A

Definition at line 521 of file gdtoaimp.h.

◆ gethex

#define gethex   gethex_D2A

Definition at line 522 of file gdtoaimp.h.

◆ hexdig

#define hexdig   hexdig_D2A

Definition at line 523 of file gdtoaimp.h.

◆ hexnan

#define hexnan   hexnan_D2A

Definition at line 524 of file gdtoaimp.h.

◆ hi0bits

#define hi0bits (   x)    hi0bits_D2A((ULong)(x))

Definition at line 525 of file gdtoaimp.h.

◆ i2b

#define i2b   i2b_D2A

Definition at line 526 of file gdtoaimp.h.

◆ increment

#define increment   increment_D2A

Definition at line 527 of file gdtoaimp.h.

◆ Int_max

#define Int_max   15

Definition at line 416 of file gdtoaimp.h.

◆ kmask

#define kmask   31

Definition at line 468 of file gdtoaimp.h.

◆ Kmax

#define Kmax   15

Definition at line 482 of file gdtoaimp.h.

◆ kshift

#define kshift   5

Definition at line 467 of file gdtoaimp.h.

◆ Llong

#define Llong   long long

Definition at line 458 of file gdtoaimp.h.

◆ lo0bits

#define lo0bits   lo0bits_D2A

Definition at line 528 of file gdtoaimp.h.

◆ Log2P

#define Log2P   1

Definition at line 412 of file gdtoaimp.h.

◆ LSB

#define LSB   0x10000

Definition at line 410 of file gdtoaimp.h.

◆ lshift

#define lshift   lshift_D2A

Definition at line 529 of file gdtoaimp.h.

◆ MALLOC

#define MALLOC   malloc

Definition at line 206 of file gdtoaimp.h.

◆ match

#define match   match_D2A

Definition at line 530 of file gdtoaimp.h.

◆ mult

#define mult   mult_D2A

Definition at line 531 of file gdtoaimp.h.

◆ multadd

#define multadd   multadd_D2A

Definition at line 532 of file gdtoaimp.h.

◆ nrv_alloc

#define nrv_alloc   nrv_alloc_D2A

Definition at line 533 of file gdtoaimp.h.

◆ P

#define P   56

Definition at line 399 of file gdtoaimp.h.

◆ Pack_32

#define Pack_32

Definition at line 442 of file gdtoaimp.h.

◆ pow5mult

#define pow5mult   pow5mult_D2A

Definition at line 534 of file gdtoaimp.h.

◆ Quick_max

#define Quick_max   15

Definition at line 415 of file gdtoaimp.h.

◆ quorem

#define quorem   quorem_D2A

Definition at line 535 of file gdtoaimp.h.

◆ ratio

#define ratio   ratio_D2A

Definition at line 536 of file gdtoaimp.h.

◆ ROUND_BIASED

#define ROUND_BIASED

Definition at line 421 of file gdtoaimp.h.

◆ rounded_product

#define rounded_product (   a,
 
)    a *= b

Definition at line 433 of file gdtoaimp.h.

◆ rounded_quotient

#define rounded_quotient (   a,
 
)    a /= b

Definition at line 434 of file gdtoaimp.h.

◆ rshift

#define rshift   rshift_D2A

Definition at line 537 of file gdtoaimp.h.

◆ rv_alloc

#define rv_alloc   rv_alloc_D2A

Definition at line 538 of file gdtoaimp.h.

◆ s2b

#define s2b   s2b_D2A

Definition at line 539 of file gdtoaimp.h.

◆ set_ones

#define set_ones   set_ones_D2A

Definition at line 540 of file gdtoaimp.h.

◆ SI

#define SI   1

Definition at line 635 of file gdtoaimp.h.

◆ Sign_bit

#define Sign_bit   0x8000

Definition at line 411 of file gdtoaimp.h.

◆ Storeinc

#define Storeinc (   a,
  b,
 
)    (((unsigned short*)a)[0] = (unsigned short)b, ((unsigned short*)a)[1] = (unsigned short)c, a++)

Definition at line 318 of file gdtoaimp.h.

◆ strcp

#define strcp   strcp_D2A

Definition at line 541 of file gdtoaimp.h.

◆ strtoIg

#define strtoIg   strtoIg_D2A

Definition at line 542 of file gdtoaimp.h.

◆ Sudden_Underflow

#define Sudden_Underflow

Definition at line 364 of file gdtoaimp.h.

◆ sum

#define sum   sum_D2A

Definition at line 543 of file gdtoaimp.h.

◆ Ten_pmax

#define Ten_pmax   24

Definition at line 406 of file gdtoaimp.h.

◆ tens

#define tens   tens_D2A

Definition at line 544 of file gdtoaimp.h.

◆ Tiny0

#define Tiny0   0x80

Definition at line 413 of file gdtoaimp.h.

◆ Tiny1

#define Tiny1   0

Definition at line 414 of file gdtoaimp.h.

◆ tinytens [1/2]

#define tinytens   tinytens_D2A

Definition at line 546 of file gdtoaimp.h.

◆ tinytens [2/2]

#define tinytens   tinytens_D2A

Definition at line 546 of file gdtoaimp.h.

◆ trailz

#define trailz   trailz_D2A

Definition at line 547 of file gdtoaimp.h.

◆ ULbits

#define ULbits   32

Definition at line 466 of file gdtoaimp.h.

◆ ULLong

#define ULLong   unsigned Llong

Definition at line 461 of file gdtoaimp.h.

◆ ulp

#define ulp   ulp_D2A

Definition at line 548 of file gdtoaimp.h.

◆ ULtod

#define ULtod   ULtod_D2A

Definition at line 508 of file gdtoaimp.h.

◆ ULtodd

#define ULtodd   ULtodd_D2A

Definition at line 509 of file gdtoaimp.h.

◆ ULtof

#define ULtof   ULtof_D2A

Definition at line 507 of file gdtoaimp.h.

◆ ULtoQ

#define ULtoQ   ULtoQ_D2A

Definition at line 506 of file gdtoaimp.h.

◆ ULtox

#define ULtox   ULtox_D2A

Definition at line 510 of file gdtoaimp.h.

◆ ULtoxL

#define ULtoxL   ULtoxL_D2A

Definition at line 511 of file gdtoaimp.h.

◆ word0

#define word0 (   x)    ((U*)&x)->L[0]

Definition at line 304 of file gdtoaimp.h.

◆ word1

#define word1 (   x)    ((U*)&x)->L[1]

Definition at line 305 of file gdtoaimp.h.

Typedef Documentation

◆ Bigint

typedef struct Bigint Bigint

Definition at line 491 of file gdtoaimp.h.

Function Documentation

◆ ANSI() [1/24]

char *rv_alloc ANSI ( (int)  )

◆ ANSI() [2/24]

int trailz ANSI ( (Bigint *)  )

◆ ANSI() [3/24]

void ULtoxL ANSI ( (ULong *, const ULong *, Long, int)  )

◆ ANSI() [4/24]

void ULtodd ANSI ( (ULong *, ULong *, Long, int)  )

◆ ANSI() [5/24]

void ULtox ANSI ( (UShort *, const ULong *, Long, int)  )

◆ ANSI() [6/24]

Bigint *set_ones ANSI ( (Bigint *, int)  )

◆ ANSI() [7/24]

double b2d ANSI ( (Bigint *, int *)  )

◆ ANSI() [8/24]

Bigint *sum ANSI ( (Bigint *, Bigint *)  )

◆ ANSI() [9/24]

void copybits ANSI ( (ULong *, int, Bigint *)  )

◆ ANSI() [10/24]

Bigint* d2b ANSI ( (double, int *, int *)  )

◆ ANSI() [11/24]

char* dtoa ANSI ( (double d, int mode, int ndigits, int *decpt, int *sign, char **rve)  )

◆ ANSI() [12/24]

char* g__fmt ANSI ( (char *, char *, const char *, int, ULong )

◆ ANSI() [13/24]

int gethex ANSI ( (CONST char **, FPI *, Long *, Bigint **, int)  )

◆ ANSI() [14/24]

int hexnan ANSI ( (CONST char **, FPI *, ULong *)  )

◆ ANSI() [15/24]

int hi0bits_D2A ANSI ( (ULong )

◆ ANSI() [16/24]

int lo0bits ANSI ( (ULong *)  )

◆ ANSI() [17/24]

int match ANSI ( (CONST char **, char *)  )

◆ ANSI() [18/24]

Bigint* multadd ANSI ( (Bigint *, int, int)  )

◆ ANSI() [19/24]

char* nrv_alloc ANSI ( (char *, char **, int)  )

◆ ANSI() [20/24]

Bigint* s2b ANSI ( (CONST char *, int, int, ULong )

◆ ANSI() [21/24]

char* strcp ANSI ( (char *, const char *)  )

◆ ANSI() [22/24]

int strtoIg ANSI ( (CONST char *, char **, FPI *, Long *, Bigint **, int *)  )

◆ ANSI() [23/24]

double strtod ANSI ( (const char *s00, char **se)  )

◆ ANSI() [24/24]

double ulp ANSI ( (double)  )

◆ hexdig_init_D2A()

void hexdig_init_D2A ( Void  )

Definition at line 52 of file hd_init.c.

53 {
54 #define USC (unsigned char*)
55  htinit(hexdig, USC "0123456789", 0x10);
56  htinit(hexdig, USC "abcdef", 0x10 + 10);
57  htinit(hexdig, USC "ABCDEF", 0x10 + 10);
58 }
unsigned char hexdig[256]
Definition: hd_init.c:34
#define USC
static void htinit(unsigned char *h, const unsigned char *s, int inc)
Definition: hd_init.c:42

References hexdig, htinit(), and USC.

Referenced by gethex(), and hexnan().

Here is the caller graph for this function:

Variable Documentation

◆ bigtens

CONST double bigtens[]

Definition at line 956 of file misc.c.

◆ dtoa_result

char* dtoa_result

Definition at line 35 of file dmisc.c.

Referenced by freedtoa(), and rv_alloc().

◆ hexdig

unsigned char hexdig[]

Definition at line 34 of file hd_init.c.

Referenced by hexdig_init_D2A().

◆ IEEE_8087

Exactly one of IEEE_8087

Definition at line 281 of file gdtoaimp.h.

◆ IEEE_MC68k

Exactly one of IEEE_MC68k

Definition at line 281 of file gdtoaimp.h.

◆ tens

CONST double tens[]

Definition at line 961 of file misc.c.

◆ tinytens

CONST double tinytens[]

Definition at line 957 of file misc.c.

◆ VAX

Exactly one of VAX

Definition at line 281 of file gdtoaimp.h.