aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/_itoa.c47
-rw-r--r--stdio-common/printf_fp.c64
-rw-r--r--stdio-common/vfscanf.c12
3 files changed, 66 insertions, 57 deletions
diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c
index 8459289..e3b0533 100644
--- a/stdio-common/_itoa.c
+++ b/stdio-common/_itoa.c
@@ -182,29 +182,32 @@ _itoa (value, buflim, base, upper_case)
mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \
\
if (BITS_PER_MP_LIMB == 32) \
- if (work_hi != 0) \
- { \
- mp_limb_t work_lo; \
- int cnt; \
+ { \
+ if (work_hi != 0) \
+ { \
+ mp_limb_t work_lo; \
+ int cnt; \
\
- work_lo = value & 0xfffffffful; \
- for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \
- { \
- *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \
- work_lo >>= BITS; \
- } \
- if (BITS_PER_MP_LIMB % BITS != 0) \
- { \
- work_lo |= ((work_hi \
- & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \
- - 1)) \
- << BITS_PER_MP_LIMB % BITS); \
- *--bp = digits[work_lo]; \
- work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \
- } \
- } \
- else \
- work_hi = value & 0xfffffffful; \
+ work_lo = value & 0xfffffffful; \
+ for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \
+ { \
+ *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \
+ work_lo >>= BITS; \
+ } \
+ if (BITS_PER_MP_LIMB % BITS != 0) \
+ { \
+ work_lo \
+ |= ((work_hi \
+ & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \
+ - 1)) \
+ << BITS_PER_MP_LIMB % BITS); \
+ *--bp = digits[work_lo]; \
+ work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \
+ } \
+ } \
+ else \
+ work_hi = value & 0xfffffffful; \
+ } \
do \
{ \
*--bp = digits[work_hi & ((1 << BITS) - 1)]; \
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index e54fac0..e5e3026 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -574,19 +574,21 @@ __printf_fp (FILE *fp,
for overflow. This is done by comparing with 10 shifted
to the right position. */
if (incr == exponent + 3)
- if (cnt_h <= BITS_PER_MP_LIMB - 4)
- {
- topval[0] = 0;
- topval[1]
- = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h);
- }
- else
- {
- topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4);
- topval[1] = 0;
- (void) __mpn_lshift (topval, topval, 2,
- BITS_PER_MP_LIMB - cnt_h);
- }
+ {
+ if (cnt_h <= BITS_PER_MP_LIMB - 4)
+ {
+ topval[0] = 0;
+ topval[1]
+ = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4 - cnt_h);
+ }
+ else
+ {
+ topval[0] = ((mp_limb_t) 10) << (BITS_PER_MP_LIMB - 4);
+ topval[1] = 0;
+ (void) __mpn_lshift (topval, topval, 2,
+ BITS_PER_MP_LIMB - cnt_h);
+ }
+ }
/* We have to be careful when multiplying the last factor.
If the result is greater than 1.0 be have to test it
@@ -816,23 +818,25 @@ __printf_fp (FILE *fp,
char *tp = cp;
if (digit == '5' && (*(cp - 1) & 1) == 0)
- /* This is the critical case. */
- if (fracsize == 1 && frac[0] == 0)
- /* Rest of the number is zero -> round to even.
- (IEEE 754-1985 4.1 says this is the default rounding.) */
- goto do_expo;
- else if (scalesize == 0)
- {
- /* Here we have to see whether all limbs are zero since no
- normalization happened. */
- size_t lcnt = fracsize;
- while (lcnt >= 1 && frac[lcnt - 1] == 0)
- --lcnt;
- if (lcnt == 0)
- /* Rest of the number is zero -> round to even.
- (IEEE 754-1985 4.1 says this is the default rounding.) */
- goto do_expo;
- }
+ {
+ /* This is the critical case. */
+ if (fracsize == 1 && frac[0] == 0)
+ /* Rest of the number is zero -> round to even.
+ (IEEE 754-1985 4.1 says this is the default rounding.) */
+ goto do_expo;
+ else if (scalesize == 0)
+ {
+ /* Here we have to see whether all limbs are zero since no
+ normalization happened. */
+ size_t lcnt = fracsize;
+ while (lcnt >= 1 && frac[lcnt - 1] == 0)
+ --lcnt;
+ if (lcnt == 0)
+ /* Rest of the number is zero -> round to even.
+ (IEEE 754-1985 4.1 says this is the default rounding.) */
+ goto do_expo;
+ }
+ }
if (fracdig_no > 0)
{
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index 116b19b..f9bbb69 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -602,11 +602,13 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
#define NEXT_WIDE_CHAR(First) \
c = inchar (); \
if (c == EOF) \
- /* EOF is only an error for the first character. */ \
- if (First) \
- input_error (); \
- else \
- break; \
+ { \
+ /* EOF is only an error for the first character. */ \
+ if (First) \
+ input_error (); \
+ else \
+ break; \
+ } \
val = c; \
if (val >= 0x80) \
{ \