On Thu, May 10, 2012 at 08:46:26AM -0700, Matthew Dempsky wrote:

> On Thu, Mar 15, 2012 at 3:19 AM, Marc Espie <[email protected]> wrote:
> >  #define __glibcxx_max(T) \
> > -  (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0)
> > +  (__glibcxx_signed (T) ? \
> > +      (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0)
> > +
> 
> How about (T)(((unsigned T)1 << __glibc_digits(T)) - 1)?
> 
> Also, we should use (T)-1 << __glibc_digits(T) in __glibc_min to avoid
> relying on overflow behavior for signed types.

This could expand to things like "unsigened unsigned int".

        -Otto

Reply via email to