Fix the __glibcxx_min and __glibcxx_max macros for a signed wchar_t.

* The __glibcxx_max macro came from GCC svn r138078, the last GPLv2
  revision of this file.
* I wrote the updated __glibcxx_min macro.
This commit is contained in:
Andrew Turner 2012-12-25 07:37:33 +00:00
parent f7a1732204
commit b8d52352a7

View File

@ -134,10 +134,11 @@
#define __glibcxx_signed(T) ((T)(-1) < 0)
#define __glibcxx_min(T) \
(__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)
(__glibcxx_signed (T) ? (((T)1 << (__glibcxx_digits (T) - 1)) << 1) : (T)0)
#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)
#define __glibcxx_digits(T) \
(sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))