/* Floating point output for `printf'.
- Copyright (C) 1995-2017 Free Software Foundation, Inc.
+ Copyright (C) 1995-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/* The gmp headers need some configuration frobs. */
#define HAVE_ALLOCA 1
+#include <array_length.h>
#include <libioP.h>
#include <alloca.h>
#include <ctype.h>
#endif
#include <assert.h>
-/* This defines make it possible to use the same code for GNU C library and
- the GNU I/O library. */
#define PUT(f, s, n) _IO_sputn (f, s, n)
#define PAD(f, c, n) (wide ? _IO_wpadn (f, c, n) : _IO_padn (f, c, n))
-/* We use this file GNU C library and GNU I/O library. So make
- names equal. */
#undef putc
#define putc(c, f) (wide \
? (int)_IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
-#define size_t _IO_size_t
-#define FILE _IO_FILE
+
\f
/* Macros for doing the actual output. */
else \
{ \
p.fracsize = __mpn_extract_##SUFFIX \
- (fp_input, \
- (sizeof (fp_input) / sizeof (fp_input[0])), \
+ (fp_input, array_length (fp_input), \
&p.exponent, &is_neg, VAR); \
to_shift = 1 + p.fracsize * BITS_PER_MP_LIMB - MANT_DIG; \
} \
}
else
{
- cy = __mpn_lshift (p.frac +
- (p.exponent + to_shift) / BITS_PER_MP_LIMB,
+ cy = __mpn_lshift (p.frac
+ + (p.exponent + to_shift) / BITS_PER_MP_LIMB,
fp_input, p.fracsize,
(p.exponent + to_shift) % BITS_PER_MP_LIMB);
p.fracsize += (p.exponent + to_shift) / BITS_PER_MP_LIMB;
&__tens[powers->arrayoff
+ _FPIO_CONST_OFFSET],
powers->arraysize - _FPIO_CONST_OFFSET);
- p.tmpsize = p.scalesize +
- powers->arraysize - _FPIO_CONST_OFFSET;
+ p.tmpsize = p.scalesize
+ + powers->arraysize - _FPIO_CONST_OFFSET;
if (cy == 0)
--p.tmpsize;
}
multiplication was not valid. This is because we cannot
determine the number of bits in the result in advance. */
if (incr < p.exponent + 3
- || (incr == p.exponent + 3 &&
- (p.tmp[p.tmpsize - 1] < topval[1]
- || (p.tmp[p.tmpsize - 1] == topval[1]
- && p.tmp[p.tmpsize - 2] < topval[0]))))
+ || (incr == p.exponent + 3
+ && (p.tmp[p.tmpsize - 1] < topval[1]
+ || (p.tmp[p.tmpsize - 1] == topval[1]
+ && p.tmp[p.tmpsize - 2] < topval[0]))))
{
/* The factor is right. Adapt binary and decimal
exponents. */
numbers are in the range of 1.0 <= |fp| < 8.0. We simply
shift it to the right place and divide it by 1.0 to get the
leading digit. (Of course this division is not really made.) */
- assert (0 <= p.exponent && p.exponent < 3 &&
- p.exponent + to_shift < BITS_PER_MP_LIMB);
+ assert (0 <= p.exponent && p.exponent < 3
+ && p.exponent + to_shift < BITS_PER_MP_LIMB);
/* Now shift the input value to its right place. */
cy = __mpn_lshift (p.frac, fp_input, p.fracsize, (p.exponent + to_shift));