1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00
* stdio-common/_itoa.c (_itoa): Fix special 32bit platform case
	with specific bases and only few bits set in second word.
This commit is contained in:
Ulrich Drepper
1999-05-05 17:08:26 +00:00
parent bc9ffe71f9
commit 4f8dbcb126
3 changed files with 47 additions and 41 deletions

View File

@@ -1,5 +1,8 @@
1999-05-05 Ulrich Drepper <drepper@cygnus.com> 1999-05-05 Ulrich Drepper <drepper@cygnus.com>
* stdio-common/_itoa.c (_itoa): Fix special 32bit platform case
with specific bases and only few bits set in second word.
* timezone/Makefile (install-others): Create target directory * timezone/Makefile (install-others): Create target directory
before creating tzfiles. before creating tzfiles.

View File

@@ -226,7 +226,7 @@ value for the actions are normally what you want, and only need to be
changed in exceptional cases. changed in exceptional cases.
If the optional @code{!} is placed before the @var{status} this means If the optional @code{!} is placed before the @var{status} this means
the following action is used for all statii but @var{status} itself. the following action is used for all statuses but @var{status} itself.
I.e., @code{!} is negation as in the C language (and others). I.e., @code{!} is negation as in the C language (and others).
Before we explain the exception which makes this action item necessary Before we explain the exception which makes this action item necessary

View File

@@ -175,46 +175,49 @@ _itoa (value, buflim, base, upper_case)
switch (base) switch (base)
{ {
#define RUN_2N(BITS) \ #define RUN_2N(BITS) \
do \ do \
{ \ { \
/* `unsigned long long int' always has 64 bits. */ \ /* `unsigned long long int' always has 64 bits. */ \
mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \ mp_limb_t work_hi = value >> (64 - BITS_PER_MP_LIMB); \
\ \
if (BITS_PER_MP_LIMB == 32) \ if (BITS_PER_MP_LIMB == 32) \
{ \ { \
if (work_hi != 0) \ if (work_hi != 0) \
{ \ { \
mp_limb_t work_lo; \ mp_limb_t work_lo; \
int cnt; \ int cnt; \
\ \
work_lo = value & 0xfffffffful; \ work_lo = value & 0xfffffffful; \
for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \ for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \
{ \ { \
*--bp = digits[work_lo & ((1ul << BITS) - 1)]; \ *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \
work_lo >>= BITS; \ work_lo >>= BITS; \
} \ } \
if (BITS_PER_MP_LIMB % BITS != 0) \ if (BITS_PER_MP_LIMB % BITS != 0) \
{ \ { \
work_lo \ work_lo \
|= ((work_hi \ |= ((work_hi \
& ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \ & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \
- 1)) \ - 1)) \
<< BITS_PER_MP_LIMB % BITS); \ << BITS_PER_MP_LIMB % BITS); \
*--bp = digits[work_lo]; \ work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \
work_hi >>= BITS - BITS_PER_MP_LIMB % BITS; \ if (work_hi == 0) \
} \ work_hi = work_lo; \
} \ else \
else \ *--bp = digits[work_lo]; \
work_hi = value & 0xfffffffful; \ } \
} \ } \
do \ else \
{ \ work_hi = value & 0xfffffffful; \
*--bp = digits[work_hi & ((1 << BITS) - 1)]; \ } \
work_hi >>= BITS; \ do \
} \ { \
while (work_hi != 0); \ *--bp = digits[work_hi & ((1 << BITS) - 1)]; \
} \ work_hi >>= BITS; \
} \
while (work_hi != 0); \
} \
while (0) while (0)
case 8: case 8:
RUN_2N (3); RUN_2N (3);