1 /* _ufix64toa_r: convert unsigned 64-bit fixed point to ASCII string.
3 * This routine converts an unsigned fixed-point number to long double format and
4 * then calls _ldtoa_r to do the conversion.
6 * Written by Jeff Johnston.
18 extern char *_simdldtoa_r
_PARAMS((struct _reent
*, LONG_DOUBLE_UNION
*, int,
19 int, int *, int *, char **));
22 * Convert an unsigned fixed-point 64-bit value to string.
24 * Ignores `locale' stuff.
28 _DEFUN (_ufix64toa_r
, (rptr
, value
, mode
, ndigits
, decpt
, sign
, rve
),
29 struct _reent
*rptr _AND
37 union long_double_union ldbl
;
38 union fix64_union fix64
;
42 /* if input is 0, no additional work is needed */
45 ldbl
.i
[0] = ldbl
.i
[1] = ldbl
.i
[2] = ldbl
.i
[3] = 0;
47 else /* otherwise, we calculate long double equivalent of value */
49 /* find exponent by locating most-significant one-bit */
52 if (hiword(fix64
) == 0)
71 /* shift input appropriately */
72 fix64
.ll
= value
<< (negexp
- 1 + (Exp_msk1
!= 0));
74 /* build long double */
76 word0(ldbl
) = (exp
<< Exp_shift
);
77 word1(ldbl
) = hiword(fix64
) << (32-Ebits
-1);
78 word2(ldbl
) = loword(fix64
) << (32-Ebits
-1);
82 word0(ldbl
) |= hiword(fix64
) >> (Ebits
+ 1);
83 word1(ldbl
) |= loword(fix64
) >> (Ebits
+ 1);
87 /* convert long double to character */
88 return _simdldtoa_r (rptr
, &ldbl
, mode
, ndigits
, decpt
, sign
, rve
);