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

Roland McGrath roland@hack.frob.com
Tue Mar 20 23:13:00 GMT 2012


> 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.


Thanks,
Roland



More information about the Libc-alpha mailing list