From be9356b6510226b71c377f60233e7ef754abb976 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 31 Jul 2014 21:23:49 -0700 Subject: [PATCH] Specialize MakeUnsigned for all signed integer types. --- format.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/format.h b/format.h index 9be7319e..c02736ab 100644 --- a/format.h +++ b/format.h @@ -424,13 +424,16 @@ struct IntTraits { template struct MakeUnsigned { typedef T Type; }; -#define SPECIALIZE_MAKE_UNSIGNED(T) \ +#define SPECIALIZE_MAKE_UNSIGNED(T, U) \ template <> \ - struct MakeUnsigned { typedef unsigned T Type; } + struct MakeUnsigned { typedef U Type; } -SPECIALIZE_MAKE_UNSIGNED(char); -SPECIALIZE_MAKE_UNSIGNED(short); -SPECIALIZE_MAKE_UNSIGNED(long); +SPECIALIZE_MAKE_UNSIGNED(char, unsigned char); +SPECIALIZE_MAKE_UNSIGNED(signed char, unsigned char); +SPECIALIZE_MAKE_UNSIGNED(short, unsigned short); +SPECIALIZE_MAKE_UNSIGNED(int, unsigned); +SPECIALIZE_MAKE_UNSIGNED(long, unsigned long); +SPECIALIZE_MAKE_UNSIGNED(LongLong, ULongLong); template struct IsLongDouble { enum {VALUE = 0}; };