This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Stephen Webb's staging headers patch
- To: libstdc++ at gcc dot gnu dot org
- Subject: Re: Stephen Webb's staging headers patch
- From: Nathan Myers <ncm at nospam dot cantrip dot org>
- Date: Sun, 22 Jul 2001 00:04:49 -0700
- References: <bkoz@redhat.com> <200107220410.AAA27402@makai.watson.ibm.com>
- Reply-To: libstdc++ at gcc dot gnu dot org
Will the changes below work for a cross-compiler on a 32-bit
machine, generating code for a 64-bit machine?
Nathan Myers
ncm at cantrip dot org
On Sun, Jul 22, 2001 at 12:10:30AM -0400, David Edelsohn wrote:
> How's this change? I think it it should be correct for the RH
> 16-bit targets as well, but I'm not sure how GCC C types are defined for
> 16-bit targets. This probably is not correct for targets with unusual
> word sizes, but it's better than the current situation.
>
> * include/bits/limits_generic.h (int): Set digits and digits10
> appropriately for word size.
> (unsigned int,long,unsigned long): Likewise.
>
> Index: limits_generic.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/libstdc++-v3/include/bits/limits_generic.h,v
> retrieving revision 1.4
> diff -c -p -r1.4 limits_generic.h
> *** limits_generic.h 2001/07/11 19:35:48 1.4
> --- limits_generic.h 2001/07/22 03:59:42
> *************** namespace std {
> *** 469,476 ****
> --- 469,481 ----
> static int max() throw()
> { return INT_MAX; }
>
> + #if INT_MAX > 32767
> static const int digits = 31;
> static const int digits10 = 9;
> + #else
> + static const int digits = 15;
> + static const int digits10 = 4;
> + #endif
> static const bool is_signed = true;
> static const bool is_integer = true;
> static const bool is_exact = true;
> *************** namespace std {
> *** 517,524 ****
> --- 522,534 ----
> static unsigned int max() throw()
> { return UINT_MAX; }
>
> + #if INT_MAX > 32767
> static const int digits = 32;
> static const int digits10 = 9;
> + #else
> + static const int digits = 16;
> + static const int digits10 = 4;
> + #endif
> static const bool is_signed = false;
> static const bool is_integer = true;
> static const bool is_exact = true;
> *************** namespace std {
> *** 565,572 ****
> --- 575,590 ----
> static long max() throw()
> { return LONG_MAX; }
>
> + #if LONG_MAX > 2147483647
> + static const int digits = 63;
> + static const int digits10 = 18;
> + #elif LONG_MAX > 32767
> static const int digits = 31;
> static const int digits10 = 9;
> + #else
> + static const int digits = 15;
> + static const int digits10 = 4;
> + #endif
> static const bool is_signed = true;
> static const bool is_integer = true;
> static const bool is_exact = true;
> *************** namespace std {
> *** 613,620 ****
> --- 631,646 ----
> static unsigned long max() throw()
> { return ULONG_MAX; }
>
> + #if LONG_MAX > 2147483647
> + static const int digits = 64;
> + static const int digits10 = 19;
> + #elif LONG_MAX > 32767
> static const int digits = 32;
> static const int digits10 = 9;
> + #else
> + static const int digits = 16;
> + static const int digits10 = 4;
> + #endif
> static const bool is_signed = false;
> static const bool is_integer = true;
> static const bool is_exact = true;