You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2008/02/01 20:15:33 UTC

Re: [PATCH] STDCXX-423

Scott,

I think we might need some help understanding how this change
is intended to solve the problem with the padding bits. FYI,
unsigned char is the only type that may not have padding bits
so I'm not sure I see how it could help.

Martin

Scott Zhong wrote:
> Index: etc/config/src/LIMITS.cpp
> ===================================================================
> --- etc/config/src/LIMITS.cpp   (revision 616446)
> +++ etc/config/src/LIMITS.cpp   (working copy)
> @@ -216,8 +216,10 @@
>  {
>      unsigned bits = 0;
>  
> -    for (unsigned char c = '\01'; c; c <<= 1, ++bits);
> +    unsigned char pc = '\02'; // arbitrary value not equal to '\01'
>  
> +    for (unsigned char c = '\01'; c; c <<= 1) { if(c == pc) break; pc =
> c; bits++; }
> +
>      printf ("#define _RWSTD_CHAR_BIT    %2u\n", bits);
>  
>      return bits;


RE: [PATCH] STDCXX-423

Posted by Scott Zhong <Sc...@roguewave.com>.
Martin, I just realized that I had worked on the wrong function.  Please
disregard the change I made on LIMITS.cpp.  I will continue to make
changes to compute_limits for this bug.

-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Friday, February 01, 2008 12:16 PM
To: dev@stdcxx.apache.org
Subject: Re: [PATCH] STDCXX-423

Scott,

I think we might need some help understanding how this change
is intended to solve the problem with the padding bits. FYI,
unsigned char is the only type that may not have padding bits
so I'm not sure I see how it could help.

Martin

Scott Zhong wrote:
> Index: etc/config/src/LIMITS.cpp
> ===================================================================
> --- etc/config/src/LIMITS.cpp   (revision 616446)
> +++ etc/config/src/LIMITS.cpp   (working copy)
> @@ -216,8 +216,10 @@
>  {
>      unsigned bits = 0;
>  
> -    for (unsigned char c = '\01'; c; c <<= 1, ++bits);
> +    unsigned char pc = '\02'; // arbitrary value not equal to '\01'
>  
> +    for (unsigned char c = '\01'; c; c <<= 1) { if(c == pc) break; pc
=
> c; bits++; }
> +
>      printf ("#define _RWSTD_CHAR_BIT    %2u\n", bits);
>  
>      return bits;