From 1b3169f405ac9250b65ee3608e2962f51d2d8e3c Mon Sep 17 00:00:00 2001 From: asynts Date: Thu, 27 Aug 2020 15:36:55 +0200 Subject: [PATCH] AK: Define MakeUnsigned and MakeSigned for char. For some weird reason the C++ standard considers char, signed char and unsigned char *three* different types. On the other hand int is just an alias for signed int, meaning that int, signed int and unsigned int are just *two* different types. https://stackoverflow.com/a/32856568/8746648 --- AK/StdLibExtras.h | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index cf13cfbf7a..93a1174396 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -329,110 +329,98 @@ inline constexpr T&& forward(typename RemoveReference::Type&& param) noexcept template struct MakeUnsigned { }; - template<> struct MakeUnsigned { typedef unsigned char Type; }; - template<> struct MakeUnsigned { typedef unsigned short Type; }; - template<> struct MakeUnsigned { typedef unsigned Type; }; - template<> struct MakeUnsigned { typedef unsigned long Type; }; - template<> struct MakeUnsigned { typedef unsigned long long Type; }; - template<> struct MakeUnsigned { typedef unsigned char Type; }; - template<> struct MakeUnsigned { typedef unsigned short Type; }; - template<> struct MakeUnsigned { typedef unsigned Type; }; - template<> struct MakeUnsigned { typedef unsigned long Type; }; - template<> struct MakeUnsigned { typedef unsigned long long Type; }; +template<> +struct MakeUnsigned { + typedef unsigned char Type; +}; template struct MakeSigned { }; - template<> struct MakeSigned { typedef signed char Type; }; - template<> struct MakeSigned { typedef short Type; }; - template<> struct MakeSigned { typedef int Type; }; - template<> struct MakeSigned { typedef long Type; }; - template<> struct MakeSigned { typedef long long Type; }; - template<> struct MakeSigned { typedef char Type; }; - template<> struct MakeSigned { typedef short Type; }; - template<> struct MakeSigned { typedef int Type; }; - template<> struct MakeSigned { typedef long Type; }; - template<> struct MakeSigned { typedef long long Type; }; +template<> +struct MakeSigned { + typedef signed char Type; +}; template struct IsVoid : IsSame::Type> {