ldtoa.c: Reindent to GNU style
* libc/stdlib/ldtoa.c: Convert to GNU style so as not to get crazy reading the code. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
e2802064b2
commit
fcc2dcbb21
|
@ -1,3 +1,8 @@
|
|||
2015-11-19 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* libc/stdlib/ldtoa.c: Convert to GNU style so as not to get crazy
|
||||
reading the code.
|
||||
|
||||
2015-11-19 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* libc/stdlib/rpmatch.c: Include sys/types.h to make GCC happy.
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
/* These are the externally visible entries. */
|
||||
/* linux name: long double _IO_strtold (char *, char **); */
|
||||
long double _strtold (char *, char **);
|
||||
char * _ldtoa_r (struct _reent *, long double, int, int, int *, int *, char **);
|
||||
char *_ldtoa_r (struct _reent *, long double, int, int, int *, int *,
|
||||
char **);
|
||||
int _ldcheck (long double *);
|
||||
#if 0
|
||||
void _IO_ldtostr (long double *, char *, int, int, char);
|
||||
|
@ -60,9 +61,12 @@ typedef struct
|
|||
unsigned short equot[NI];
|
||||
} LDPARMS;
|
||||
|
||||
static void esub(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, LDPARMS *ldp);
|
||||
static void emul(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, LDPARMS *ldp);
|
||||
static void ediv(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, LDPARMS *ldp);
|
||||
static void esub (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, LDPARMS * ldp);
|
||||
static void emul (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, LDPARMS * ldp);
|
||||
static void ediv (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, LDPARMS * ldp);
|
||||
static int ecmp (_CONST short unsigned int *a, _CONST short unsigned int *b);
|
||||
static int enormlz (short unsigned int *x);
|
||||
static int eshift (short unsigned int *x, int sc);
|
||||
|
@ -73,11 +77,14 @@ static void eshdn1(register short unsigned int *x);
|
|||
static void eshdn8 (register short unsigned int *x);
|
||||
static void eshdn6 (register short unsigned int *x);
|
||||
static void eneg (short unsigned int *x);
|
||||
static void emov(register _CONST short unsigned int *a, register short unsigned int *b);
|
||||
static void emov (register _CONST short unsigned int *a,
|
||||
register short unsigned int *b);
|
||||
static void eclear (register short unsigned int *x);
|
||||
static void einfin (register short unsigned int *x, register LDPARMS * ldp);
|
||||
static void efloor(short unsigned int *x, short unsigned int *y, LDPARMS *ldp);
|
||||
static void etoasc(short unsigned int *x, char *string, int ndigs, int outformat, LDPARMS *ldp);
|
||||
static void efloor (short unsigned int *x, short unsigned int *y,
|
||||
LDPARMS * ldp);
|
||||
static void etoasc (short unsigned int *x, char *string, int ndigs,
|
||||
int outformat, LDPARMS * ldp);
|
||||
|
||||
union uconv
|
||||
{
|
||||
|
@ -86,13 +93,17 @@ union uconv
|
|||
};
|
||||
|
||||
#if LDBL_MANT_DIG == 24
|
||||
static void e24toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
|
||||
static void e24toe (short unsigned int *pe, short unsigned int *y,
|
||||
LDPARMS * ldp);
|
||||
#elif LDBL_MANT_DIG == 53
|
||||
static void e53toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
|
||||
static void e53toe (short unsigned int *pe, short unsigned int *y,
|
||||
LDPARMS * ldp);
|
||||
#elif LDBL_MANT_DIG == 64
|
||||
static void e64toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
|
||||
static void e64toe (short unsigned int *pe, short unsigned int *y,
|
||||
LDPARMS * ldp);
|
||||
#else
|
||||
static void e113toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
|
||||
static void e113toe (short unsigned int *pe, short unsigned int *y,
|
||||
LDPARMS * ldp);
|
||||
#endif
|
||||
|
||||
/* econst.c */
|
||||
|
@ -100,23 +111,26 @@ static void e113toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
|
|||
|
||||
#if NE == 10
|
||||
/* 0.0 */
|
||||
static _CONST unsigned short ezero[NE] =
|
||||
{0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,};
|
||||
static _CONST unsigned short ezero[NE] = { 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
/* 1.0E0 */
|
||||
static _CONST unsigned short eone[NE] =
|
||||
{0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,};
|
||||
static _CONST unsigned short eone[NE] = { 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/* 0.0 */
|
||||
static _CONST unsigned short ezero[NE] = {
|
||||
0, 0000000,0000000,0000000,0000000,0000000,};
|
||||
0, 0000000, 0000000, 0000000, 0000000, 0000000,
|
||||
};
|
||||
|
||||
/* 1.0E0 */
|
||||
static _CONST unsigned short eone[NE] = {
|
||||
0, 0000000,0000000,0000000,0100000,0x3fff,};
|
||||
0, 0000000, 0000000, 0000000, 0100000, 0x3fff,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -135,6 +149,7 @@ static _CONST char * _CONST ermsg[7] = {
|
|||
"total loss of precision",
|
||||
"partial loss of precision"
|
||||
};
|
||||
|
||||
#define mtherr(name, code) printf( "\n%s %s error\n", name, ermsg[code] );
|
||||
#else
|
||||
#define mtherr(name, code)
|
||||
|
@ -395,8 +410,10 @@ typedef struct
|
|||
|
||||
static void eaddm (short unsigned int *x, short unsigned int *y);
|
||||
static void esubm (short unsigned int *x, short unsigned int *y);
|
||||
static void emdnorm(short unsigned int *s, int lost, int subflg, long int exp, int rcntrl, LDPARMS *ldp);
|
||||
static int asctoeg(char *ss, short unsigned int *y, int oprec, LDPARMS *ldp);
|
||||
static void emdnorm (short unsigned int *s, int lost, int subflg,
|
||||
long int exp, int rcntrl, LDPARMS * ldp);
|
||||
static int asctoeg (char *ss, short unsigned int *y, int oprec,
|
||||
LDPARMS * ldp);
|
||||
static void enan (short unsigned int *nan, int size);
|
||||
#if LDBL_MANT_DIG == 24
|
||||
static void toe24 (short unsigned int *x, short unsigned int *y);
|
||||
|
@ -407,17 +424,24 @@ static void toe64(short unsigned int *a, short unsigned int *b);
|
|||
#else
|
||||
static void toe113 (short unsigned int *a, short unsigned int *b);
|
||||
#endif
|
||||
static void eiremain(short unsigned int *den, short unsigned int *num, LDPARMS *ldp);
|
||||
static int ecmpm(register short unsigned int *a, register short unsigned int *b);
|
||||
static int edivm(short unsigned int *den, short unsigned int *num, LDPARMS *ldp);
|
||||
static int emulm(short unsigned int *a, short unsigned int *b, LDPARMS *ldp);
|
||||
static void eiremain (short unsigned int *den, short unsigned int *num,
|
||||
LDPARMS * ldp);
|
||||
static int ecmpm (register short unsigned int *a,
|
||||
register short unsigned int *b);
|
||||
static int edivm (short unsigned int *den, short unsigned int *num,
|
||||
LDPARMS * ldp);
|
||||
static int emulm (short unsigned int *a, short unsigned int *b,
|
||||
LDPARMS * ldp);
|
||||
static int eisneg (_CONST short unsigned int *x);
|
||||
static int eisinf (_CONST short unsigned int *x);
|
||||
static void emovi (_CONST short unsigned int *a, short unsigned int *b);
|
||||
static void emovo(short unsigned int *a, short unsigned int *b, LDPARMS *ldp);
|
||||
static void emovz(register short unsigned int *a, register short unsigned int *b);
|
||||
static void emovo (short unsigned int *a, short unsigned int *b,
|
||||
LDPARMS * ldp);
|
||||
static void emovz (register short unsigned int *a,
|
||||
register short unsigned int *b);
|
||||
static void ecleaz (register short unsigned int *xi);
|
||||
static void eadd1(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, int subflg, LDPARMS *ldp);
|
||||
static void eadd1 (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, int subflg, LDPARMS * ldp);
|
||||
static int eisnan (_CONST short unsigned int *x);
|
||||
static int eiisnan (short unsigned int *x);
|
||||
|
||||
|
@ -432,7 +456,8 @@ static void etodec(), todec(), dectoe();
|
|||
; eclear( x );
|
||||
*/
|
||||
|
||||
static void eclear(register short unsigned int *x)
|
||||
static void
|
||||
eclear (register short unsigned int *x)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -447,7 +472,8 @@ for( i=0; i<NE; i++ )
|
|||
* emov( a, b );
|
||||
*/
|
||||
|
||||
static void emov(register _CONST short unsigned int *a, register short unsigned int *b)
|
||||
static void
|
||||
emov (register _CONST short unsigned int *a, register short unsigned int *b)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -463,7 +489,8 @@ for( i=0; i<NE; i++ )
|
|||
; eneg( x );
|
||||
*/
|
||||
|
||||
static void eneg(short unsigned int *x)
|
||||
static void
|
||||
eneg (short unsigned int *x)
|
||||
{
|
||||
|
||||
#ifdef NANS
|
||||
|
@ -478,7 +505,8 @@ x[NE-1] ^= 0x8000; /* Toggle the sign bit */
|
|||
/* Return 1 if external format number is negative,
|
||||
* else return zero.
|
||||
*/
|
||||
static int eisneg(_CONST short unsigned int *x)
|
||||
static int
|
||||
eisneg (_CONST short unsigned int *x)
|
||||
{
|
||||
|
||||
#ifdef NANS
|
||||
|
@ -495,7 +523,8 @@ else
|
|||
/* Return 1 if external format number has maximum possible exponent,
|
||||
* else return zero.
|
||||
*/
|
||||
static int eisinf(_CONST short unsigned int *x)
|
||||
static int
|
||||
eisinf (_CONST short unsigned int *x)
|
||||
{
|
||||
|
||||
if ((x[NE - 1] & 0x7fff) == 0x7fff)
|
||||
|
@ -512,7 +541,8 @@ else
|
|||
|
||||
/* Check if e-type number is not a number.
|
||||
*/
|
||||
static int eisnan(_CONST short unsigned int *x)
|
||||
static int
|
||||
eisnan (_CONST short unsigned int *x)
|
||||
{
|
||||
|
||||
#ifdef NANS
|
||||
|
@ -539,7 +569,8 @@ return (0);
|
|||
; operations involving inifinity.
|
||||
*/
|
||||
|
||||
static void einfin(register short unsigned int *x, register LDPARMS *ldp)
|
||||
static void
|
||||
einfin (register short unsigned int *x, register LDPARMS * ldp)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -580,7 +611,8 @@ if( ldp->rndprc < NBITS )
|
|||
/* Move in external format number,
|
||||
* converting it to internal format.
|
||||
*/
|
||||
static void emovi(_CONST short unsigned int *a, short unsigned int *b)
|
||||
static void
|
||||
emovi (_CONST short unsigned int *a, short unsigned int *b)
|
||||
{
|
||||
register _CONST unsigned short *p;
|
||||
register unsigned short *q;
|
||||
|
@ -626,7 +658,8 @@ for( i=0; i<NE-1; i++ )
|
|||
/* Move internal format number out,
|
||||
* converting it to external format.
|
||||
*/
|
||||
static void emovo(short unsigned int *a, short unsigned int *b, LDPARMS *ldp)
|
||||
static void
|
||||
emovo (short unsigned int *a, short unsigned int *b, LDPARMS * ldp)
|
||||
{
|
||||
register unsigned short *p, *q;
|
||||
unsigned short i;
|
||||
|
@ -664,7 +697,8 @@ for( i=0; i<NE-1; i++ )
|
|||
/* Clear out internal format number.
|
||||
*/
|
||||
|
||||
static void ecleaz(register short unsigned int *xi)
|
||||
static void
|
||||
ecleaz (register short unsigned int *xi)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -674,7 +708,8 @@ for( i=0; i<NI; i++ )
|
|||
|
||||
/* same, but don't touch the sign. */
|
||||
|
||||
static void ecleazs(register short unsigned int *xi)
|
||||
static void
|
||||
ecleazs (register short unsigned int *xi)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -688,7 +723,8 @@ for(i=0; i<NI-1; i++)
|
|||
|
||||
/* Move internal format number from a to b.
|
||||
*/
|
||||
static void emovz(register short unsigned int *a, register short unsigned int *b)
|
||||
static void
|
||||
emovz (register short unsigned int *a, register short unsigned int *b)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -701,7 +737,8 @@ for( i=0; i<NI-1; i++ )
|
|||
/* Return nonzero if internal format number is a NaN.
|
||||
*/
|
||||
|
||||
static int eiisnan (short unsigned int *x)
|
||||
static int
|
||||
eiisnan (short unsigned int *x)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -745,7 +782,8 @@ eiisinf (unsigned short x[])
|
|||
; 0 if a == b
|
||||
; -1 if a < b
|
||||
*/
|
||||
static int ecmpm(register short unsigned int *a, register short unsigned int *b)
|
||||
static int
|
||||
ecmpm (register short unsigned int *a, register short unsigned int *b)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -770,7 +808,8 @@ else
|
|||
; Shift significand down by 1 bit
|
||||
*/
|
||||
|
||||
static void eshdn1(register short unsigned int *x)
|
||||
static void
|
||||
eshdn1 (register short unsigned int *x)
|
||||
{
|
||||
register unsigned short bits;
|
||||
int i;
|
||||
|
@ -796,7 +835,8 @@ for( i=M; i<NI; i++ )
|
|||
; Shift significand up by 1 bit
|
||||
*/
|
||||
|
||||
static void eshup1(register short unsigned int *x)
|
||||
static void
|
||||
eshup1 (register short unsigned int *x)
|
||||
{
|
||||
register unsigned short bits;
|
||||
int i;
|
||||
|
@ -822,7 +862,8 @@ for( i=M; i<NI; i++ )
|
|||
; Shift significand down by 8 bits
|
||||
*/
|
||||
|
||||
static void eshdn8(register short unsigned int *x)
|
||||
static void
|
||||
eshdn8 (register short unsigned int *x)
|
||||
{
|
||||
register unsigned short newbyt, oldbyt;
|
||||
int i;
|
||||
|
@ -843,7 +884,8 @@ for( i=M; i<NI; i++ )
|
|||
; Shift significand up by 8 bits
|
||||
*/
|
||||
|
||||
static void eshup8(register short unsigned int *x)
|
||||
static void
|
||||
eshup8 (register short unsigned int *x)
|
||||
{
|
||||
int i;
|
||||
register unsigned short newbyt, oldbyt;
|
||||
|
@ -865,7 +907,8 @@ for( i=M; i<NI; i++ )
|
|||
; Shift significand up by 16 bits
|
||||
*/
|
||||
|
||||
static void eshup6(register short unsigned int *x)
|
||||
static void
|
||||
eshup6 (register short unsigned int *x)
|
||||
{
|
||||
int i;
|
||||
register unsigned short *p;
|
||||
|
@ -883,7 +926,8 @@ for( i=M; i<NI-1; i++ )
|
|||
; Shift significand down by 16 bits
|
||||
*/
|
||||
|
||||
static void eshdn6(register short unsigned int *x)
|
||||
static void
|
||||
eshdn6 (register short unsigned int *x)
|
||||
{
|
||||
int i;
|
||||
register unsigned short *p;
|
||||
|
@ -902,7 +946,8 @@ for( i=M; i<NI-1; i++ )
|
|||
; x + y replaces y
|
||||
*/
|
||||
|
||||
static void eaddm(short unsigned int *x, short unsigned int *y)
|
||||
static void
|
||||
eaddm (short unsigned int *x, short unsigned int *y)
|
||||
{
|
||||
register unsigned long a;
|
||||
int i;
|
||||
|
@ -929,7 +974,8 @@ for( i=M; i<NI; i++ )
|
|||
; y - x replaces y
|
||||
*/
|
||||
|
||||
static void esubm(short unsigned int *x, short unsigned int *y)
|
||||
static void
|
||||
esubm (short unsigned int *x, short unsigned int *y)
|
||||
{
|
||||
unsigned long a;
|
||||
int i;
|
||||
|
@ -958,7 +1004,8 @@ for( i=M; i<NI; i++ )
|
|||
/* Multiply significand of e-type number b
|
||||
by 16-bit quantity a, e-type result to c. */
|
||||
|
||||
static void m16m(short unsigned int a, short unsigned int *b, short unsigned int *c)
|
||||
static void
|
||||
m16m (short unsigned int a, short unsigned int *b, short unsigned int *c)
|
||||
{
|
||||
register unsigned short *pp;
|
||||
register unsigned long carry;
|
||||
|
@ -1000,7 +1047,8 @@ for( i=M; i<NI; i++ )
|
|||
is permitted to have its high guard word nonzero. */
|
||||
|
||||
|
||||
static int edivm(short unsigned int *den, short unsigned int *num, LDPARMS *ldp)
|
||||
static int
|
||||
edivm (short unsigned int *den, short unsigned int *num, LDPARMS * ldp)
|
||||
{
|
||||
int i;
|
||||
register unsigned short *p;
|
||||
|
@ -1090,7 +1138,8 @@ return( (int )j );
|
|||
|
||||
|
||||
/* Multiply significands */
|
||||
static int emulm(short unsigned int *a, short unsigned int *b, LDPARMS *ldp)
|
||||
static int
|
||||
emulm (short unsigned int *a, short unsigned int *b, LDPARMS * ldp)
|
||||
{
|
||||
unsigned short *p, *q;
|
||||
unsigned short pprod[NI];
|
||||
|
@ -1163,7 +1212,9 @@ printf( "\n" );
|
|||
*/
|
||||
|
||||
|
||||
static void emdnorm(short unsigned int *s, int lost, int subflg, long int exp, int rcntrl, LDPARMS *ldp)
|
||||
static void
|
||||
emdnorm (short unsigned int *s, int lost, int subflg, long int exp,
|
||||
int rcntrl, LDPARMS * ldp)
|
||||
{
|
||||
int i, j;
|
||||
unsigned short r;
|
||||
|
@ -1369,7 +1420,9 @@ else
|
|||
; esub( a, b, c, ldp ); c = b - a
|
||||
*/
|
||||
|
||||
static void esub(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, LDPARMS *ldp)
|
||||
static void
|
||||
esub (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, LDPARMS * ldp)
|
||||
{
|
||||
|
||||
#ifdef NANS
|
||||
|
@ -1398,7 +1451,9 @@ eadd1( a, b, c, 1, ldp );
|
|||
|
||||
|
||||
|
||||
static void eadd1(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, int subflg, LDPARMS *ldp)
|
||||
static void
|
||||
eadd1 (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, int subflg, LDPARMS * ldp)
|
||||
{
|
||||
unsigned short ai[NI], bi[NI], ci[NI];
|
||||
int i, lost, j, k;
|
||||
|
@ -1507,7 +1562,9 @@ emovo( bi, c, ldp );
|
|||
; LDPARMS *ldp;
|
||||
; ediv( a, b, c, ldp ); c = b / a
|
||||
*/
|
||||
static void ediv(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, LDPARMS *ldp)
|
||||
static void
|
||||
ediv (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, LDPARMS * ldp)
|
||||
{
|
||||
unsigned short ai[NI], bi[NI];
|
||||
int i;
|
||||
|
@ -1611,7 +1668,9 @@ emovo( bi, c, ldp );
|
|||
; LDPARMS *ldp
|
||||
; emul( a, b, c, ldp ); c = b * a
|
||||
*/
|
||||
static void emul(_CONST short unsigned int *a, _CONST short unsigned int *b, short unsigned int *c, LDPARMS *ldp)
|
||||
static void
|
||||
emul (_CONST short unsigned int *a, _CONST short unsigned int *b,
|
||||
short unsigned int *c, LDPARMS * ldp)
|
||||
{
|
||||
unsigned short ai[NI], bi[NI];
|
||||
int i, j;
|
||||
|
@ -1700,7 +1759,8 @@ emovo( bi, c, ldp );
|
|||
|
||||
|
||||
#if LDBL_MANT_DIG > 64
|
||||
static void e113toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
|
||||
static void
|
||||
e113toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp)
|
||||
{
|
||||
register unsigned short r;
|
||||
unsigned short *e, *p;
|
||||
|
@ -1773,7 +1833,8 @@ emovo(yy,y,ldp);
|
|||
}
|
||||
|
||||
/* move out internal format to ieee long double */
|
||||
static void toe113(short unsigned int *a, short unsigned int *b)
|
||||
static void
|
||||
toe113 (short unsigned int *a, short unsigned int *b)
|
||||
{
|
||||
register unsigned short *p, *q;
|
||||
unsigned short i;
|
||||
|
@ -1825,7 +1886,8 @@ for (i = 0; i < 7; i++)
|
|||
|
||||
|
||||
#if LDBL_MANT_DIG == 64
|
||||
static void e64toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
|
||||
static void
|
||||
e64toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp)
|
||||
{
|
||||
unsigned short yy[NI];
|
||||
unsigned short *p, *q, *e;
|
||||
|
@ -1907,7 +1969,8 @@ for( i=0; i<NE; i++ )
|
|||
}
|
||||
|
||||
/* move out internal format to ieee long double */
|
||||
static void toe64(short unsigned int *a, short unsigned int *b)
|
||||
static void
|
||||
toe64 (short unsigned int *a, short unsigned int *b)
|
||||
{
|
||||
register unsigned short *p, *q;
|
||||
unsigned short i;
|
||||
|
@ -1981,7 +2044,8 @@ for( i=0; i<4; i++ )
|
|||
; unsigned short x[N+2];
|
||||
; e53toe( &d, x );
|
||||
*/
|
||||
static void e53toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
|
||||
static void
|
||||
e53toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp)
|
||||
{
|
||||
#ifdef DEC
|
||||
|
||||
|
@ -2078,13 +2142,15 @@ emovo( yy, y, ldp );
|
|||
|
||||
#ifdef DEC
|
||||
|
||||
static void etoe53( x, e )
|
||||
static void
|
||||
etoe53 (x, e)
|
||||
unsigned short *x, *e;
|
||||
{
|
||||
etodec (x, e); /* see etodec.c */
|
||||
}
|
||||
|
||||
static void toe53( x, y )
|
||||
static void
|
||||
toe53 (x, y)
|
||||
unsigned short *x, *y;
|
||||
{
|
||||
todec (x, y);
|
||||
|
@ -2092,7 +2158,8 @@ todec( x, y );
|
|||
|
||||
#else
|
||||
|
||||
static void toe53(short unsigned int *x, short unsigned int *y)
|
||||
static void
|
||||
toe53 (short unsigned int *x, short unsigned int *y)
|
||||
{
|
||||
unsigned short i;
|
||||
unsigned short *p;
|
||||
|
@ -2179,7 +2246,8 @@ i |= *p++ & (unsigned short )0x0f; /* *p = xi[M] */
|
|||
; unsigned short x[N+2];
|
||||
; dtox( &d, x );
|
||||
*/
|
||||
void e24toe( short unsigned int *pe, short unsigned int *y, LDPARMS *ldp )
|
||||
void
|
||||
e24toe (short unsigned int *pe, short unsigned int *y, LDPARMS * ldp)
|
||||
{
|
||||
register unsigned short r;
|
||||
register unsigned short *p, *e;
|
||||
|
@ -2258,7 +2326,8 @@ if( denorm )
|
|||
emovo (yy, y, ldp);
|
||||
}
|
||||
|
||||
static void toe24(short unsigned int *x, short unsigned int *y)
|
||||
static void
|
||||
toe24 (short unsigned int *x, short unsigned int *y)
|
||||
{
|
||||
unsigned short i;
|
||||
unsigned short *p;
|
||||
|
@ -2345,7 +2414,8 @@ i |= *p++ & (unsigned short )0x7f; /* *p = xi[M] */
|
|||
* -1 if a < b
|
||||
* -2 if either a or b is a NaN.
|
||||
*/
|
||||
static int ecmp(_CONST short unsigned int *a, _CONST short unsigned int *b)
|
||||
static int
|
||||
ecmp (_CONST short unsigned int *a, _CONST short unsigned int *b)
|
||||
{
|
||||
unsigned short ai[NI], bi[NI];
|
||||
register unsigned short *p, *q;
|
||||
|
@ -2412,7 +2482,8 @@ else
|
|||
; Shifts significand area up or down by the number of bits
|
||||
; given by the variable sc.
|
||||
*/
|
||||
static int eshift(short unsigned int *x, int sc)
|
||||
static int
|
||||
eshift (short unsigned int *x, int sc)
|
||||
{
|
||||
unsigned short lost;
|
||||
unsigned short *p;
|
||||
|
@ -2480,7 +2551,8 @@ return( (int )lost );
|
|||
; Shift normalizes the significand area pointed to by argument
|
||||
; shift count (up = positive) is returned.
|
||||
*/
|
||||
static int enormlz(short unsigned int *x)
|
||||
static int
|
||||
enormlz (short unsigned int *x)
|
||||
{
|
||||
register unsigned short *p;
|
||||
int sc;
|
||||
|
@ -2555,8 +2627,7 @@ return( sc );
|
|||
#define MAXP 4096
|
||||
|
||||
#if NE == 10
|
||||
static _CONST unsigned short etens[NTEN + 1][NE] =
|
||||
{
|
||||
static _CONST unsigned short etens[NTEN + 1][NE] = {
|
||||
{0x6576, 0x4a92, 0x804a, 0x153f,
|
||||
0xc94c, 0x979a, 0x8a20, 0x5202, 0xc460, 0x7525,}, /* 10**4096 */
|
||||
{0x6a32, 0xce52, 0x329a, 0x28ce,
|
||||
|
@ -2585,8 +2656,7 @@ static _CONST unsigned short etens[NTEN + 1][NE] =
|
|||
0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x4002,}, /* 10**1 */
|
||||
};
|
||||
|
||||
static _CONST unsigned short emtens[NTEN + 1][NE] =
|
||||
{
|
||||
static _CONST unsigned short emtens[NTEN + 1][NE] = {
|
||||
{0x2030, 0xcffc, 0xa1c3, 0x8123,
|
||||
0x2de3, 0x9fde, 0xd2ce, 0x04c8, 0xa6dd, 0x0ad8,}, /* 10**-4096 */
|
||||
{0x8264, 0xd2cb, 0xf2ea, 0x12d4,
|
||||
|
@ -2654,7 +2724,8 @@ static _CONST unsigned short emtens[NTEN+1][NE] = {
|
|||
|
||||
|
||||
#if 0
|
||||
void _IO_ldtostr(x, string, ndigs, flags, fmt)
|
||||
void
|
||||
_IO_ldtostr (x, string, ndigs, flags, fmt)
|
||||
long double *x;
|
||||
char *string;
|
||||
int ndigs;
|
||||
|
@ -2706,8 +2777,8 @@ if (fmt == 'E')
|
|||
/* This routine will not return more than NDEC+1 digits. */
|
||||
|
||||
char *
|
||||
_ldtoa_r (struct _reent *ptr, long double d, int mode, int ndigits, int *decpt,
|
||||
int *sign, char **rve)
|
||||
_ldtoa_r (struct _reent *ptr, long double d, int mode, int ndigits,
|
||||
int *decpt, int *sign, char **rve)
|
||||
{
|
||||
unsigned short e[NI];
|
||||
char *s, *p;
|
||||
|
@ -2842,7 +2913,8 @@ else /* account for sign + max precision digs + E + exp sign + exponent */
|
|||
i = orig_ndigits + MAX_EXP_DIGITS + 4;
|
||||
|
||||
j = sizeof (__ULong);
|
||||
for (_REENT_MP_RESULT_K(ptr) = 0; sizeof (_Bigint) - sizeof (__ULong) + j <= i; j <<= 1)
|
||||
for (_REENT_MP_RESULT_K (ptr) = 0;
|
||||
sizeof (_Bigint) - sizeof (__ULong) + j <= i; j <<= 1)
|
||||
_REENT_MP_RESULT_K (ptr)++;
|
||||
_REENT_MP_RESULT (ptr) = Balloc (ptr, _REENT_MP_RESULT_K (ptr));
|
||||
|
||||
|
@ -2895,7 +2967,9 @@ else
|
|||
return (0);
|
||||
} /* _ldcheck */
|
||||
|
||||
static void etoasc(short unsigned int *x, char *string, int ndigits, int outformat, LDPARMS *ldp)
|
||||
static void
|
||||
etoasc (short unsigned int *x, char *string, int ndigits, int outformat,
|
||||
LDPARMS * ldp)
|
||||
{
|
||||
long digit;
|
||||
unsigned short y[NI], t[NI], u[NI], w[NI];
|
||||
|
@ -3227,7 +3301,8 @@ ldp->outexpon = expon;
|
|||
; asctoq( string, q );
|
||||
*/
|
||||
|
||||
long double _strtold (char *s, char **se)
|
||||
long double
|
||||
_strtold (char *s, char **se)
|
||||
{
|
||||
union uconv x;
|
||||
LDPARMS rnd;
|
||||
|
@ -3312,8 +3387,7 @@ if( (k >= 0) && (k <= 9) )
|
|||
/* Check for syntax error */
|
||||
c = *sp & 0x7f;
|
||||
if ((c != 'e') && (c != 'E') && (c != '\0')
|
||||
&& (c != '\n') && (c != '\r') && (c != ' ')
|
||||
&& (c != ',') )
|
||||
&& (c != '\n') && (c != '\r') && (c != ' ') && (c != ','))
|
||||
goto error;
|
||||
--sp;
|
||||
while (*sp == '0')
|
||||
|
@ -3600,7 +3674,8 @@ static _CONST unsigned short bmask[] = {
|
|||
0x0000,
|
||||
};
|
||||
|
||||
static void efloor(short unsigned int *x, short unsigned int *y, LDPARMS *ldp)
|
||||
static void
|
||||
efloor (short unsigned int *x, short unsigned int *y, LDPARMS * ldp)
|
||||
{
|
||||
register unsigned short *p;
|
||||
int e, expon, i;
|
||||
|
@ -3646,7 +3721,8 @@ if( (unsigned short )expon & (unsigned short )0x8000 )
|
|||
|
||||
|
||||
|
||||
static void eiremain(short unsigned int *den, short unsigned int *num, LDPARMS *ldp)
|
||||
static void
|
||||
eiremain (short unsigned int *den, short unsigned int *num, LDPARMS * ldp)
|
||||
{
|
||||
long ld, ln;
|
||||
unsigned short j;
|
||||
|
@ -3681,9 +3757,12 @@ emdnorm( num, 0, 0, ln, 0, ldp );
|
|||
#ifdef MIEEE
|
||||
#if !defined(__mips)
|
||||
static _CONST unsigned short nan113[8] = {
|
||||
0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
|
||||
0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
|
||||
static _CONST unsigned short nan64[6] = {
|
||||
0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
|
||||
0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
static _CONST unsigned short nan53[4] = { 0x7fff, 0xffff, 0xffff, 0xffff };
|
||||
static _CONST unsigned short nan24[2] = { 0x7fff, 0xffff };
|
||||
#elif defined(__mips_nan2008) /* __mips */
|
||||
|
@ -3693,9 +3772,12 @@ static _CONST unsigned short nan53[4] = {0x7ff8, 0, 0, 0};
|
|||
static _CONST unsigned short nan24[2] = { 0x7fc0, 0 };
|
||||
#else /* __mips && !__mips_nan2008 */
|
||||
static _CONST unsigned short nan113[8] = {
|
||||
0x7fff, 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
|
||||
0x7fff, 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
|
||||
static _CONST unsigned short nan64[6] = {
|
||||
0x7fff, 0xbfff, 0xffff, 0xffff, 0xffff, 0xffff};
|
||||
0x7fff, 0xbfff, 0xffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
static _CONST unsigned short nan53[4] = { 0x7ff7, 0xffff, 0xffff, 0xffff };
|
||||
static _CONST unsigned short nan24[2] = { 0x7fbf, 0xffff };
|
||||
#endif /* __mips && !__mips_nan2008 */
|
||||
|
@ -3707,16 +3789,20 @@ static _CONST unsigned short nan53[4] = {0, 0, 0, 0x7ff8};
|
|||
static _CONST unsigned short nan24[2] = { 0, 0x7fc0 };
|
||||
#else /* __mips && !__mips_nan2008 */
|
||||
static _CONST unsigned short nan113[8] = {
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x7fff};
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x7fff
|
||||
};
|
||||
|
||||
static _CONST unsigned short nan64[6] = {
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xbfff, 0x7fff};
|
||||
0xffff, 0xffff, 0xffff, 0xffff, 0xbfff, 0x7fff
|
||||
};
|
||||
static _CONST unsigned short nan53[4] = { 0xffff, 0xffff, 0xffff, 0x7ff7 };
|
||||
static _CONST unsigned short nan24[2] = { 0xffff, 0x7fbf };
|
||||
#endif /* __mips && !__mips_nan2008 */
|
||||
#endif /* !MIEEE */
|
||||
|
||||
|
||||
static void enan (short unsigned int *nan, int size)
|
||||
static void
|
||||
enan (short unsigned int *nan, int size)
|
||||
{
|
||||
int i, n;
|
||||
_CONST unsigned short *p;
|
||||
|
|
Loading…
Reference in New Issue