On Thu, Mar 15, 2012 at 3:19 AM, Marc Espie <es...@nerim.net> 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.