PATCH: Use long long in _itoa and _itowa if PREFER_LONG_LONG is defined

H.J. Lu hjl.tools@gmail.com
Wed Mar 21 01:12:00 GMT 2012


On Tue, Mar 20, 2012 at 4:13 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> Here is the smaller change.  OK to install?
>
> As always, your posting should mention what testing you've done.
>
>> 2012-03-20  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * stdio-common/_itoa.c: Check _ITOA_NEEDED instead of
>>       LLONG_MAX != LONG_MAX.
>>       (_itoa_word): Use _ITOA_WORD_TYPE on value.
>>       (_fitoa_word): Likewise.
>>
>>       * stdio-common/_itowa.c: Check _ITOWA_NEEDED instead of
>>       LLONG_MAX != LONG_MAX.
>>
>>       * stdio-common/_itowa.h: Include <limits.h>.
>>       (_ITOWA_NEEDED): New macro.  Defined only if not defined.
>>       (_ITOWA_WORD_TYPE): Likewise.
>>       (_itowa_word): Use _ITOA_WORD_TYPE on value.
>>       (_itowa): New macro.  Defined only if _ITOWA_NEEDED is false.
>>
>>       * sysdeps/generic/_itoa.h (_ITOA_NEEDED): New macro.  Defined
>>       only if not defined.
>>       (_ITOA_WORD_TYPE): Likewise.
>>       (_itoa_word): Use _ITOA_WORD_TYPE on value.
>>       Check !_ITOA_NEEDED instead of LONG_MAX == LLONG_MAX.
>
> This should be all one paragraph.
>
>> +#ifndef _ITOWA_NEEDED
>> +# define _ITOWA_NEEDED               (LONG_MAX != LLONG_MAX)
>> +#endif
>> +#ifndef _ITOWA_WORD_TYPE
>> +# define _ITOWA_WORD_TYPE    unsigned long int
>> +#endif
>
> This should have a comment explaining what's going on here.
>
>> +#ifndef _ITOA_NEEDED
>> +# define _ITOA_NEEDED                (LONG_MAX != LLONG_MAX)
>> +#endif
>> +#ifndef _ITOA_WORD_TYPE
>> +# define _ITOA_WORD_TYPE     unsigned long int
>> +#endif
>
> Likewise.
>
>

Here is the updated patch.  Tested on Linux/x86-64 and Linux/ia32.
OK to install?

Thanks.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libc-itoa-2.patch
Type: text/x-patch
Size: 6468 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120321/786e07bf/attachment.bin>


More information about the Libc-alpha mailing list