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
This commit is contained in:
parent
8a364c503d
commit
1b3169f405
Notes:
sideshowbarker
2024-07-19 03:05:37 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/1b3169f405a Pull-request: https://github.com/SerenityOS/serenity/pull/3318
1 changed files with 8 additions and 20 deletions
|
@ -329,110 +329,98 @@ inline constexpr T&& forward(typename RemoveReference<T>::Type&& param) noexcept
|
|||
template<typename T>
|
||||
struct MakeUnsigned {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<signed char> {
|
||||
typedef unsigned char Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<short> {
|
||||
typedef unsigned short Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<int> {
|
||||
typedef unsigned Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<long> {
|
||||
typedef unsigned long Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<long long> {
|
||||
typedef unsigned long long Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<unsigned char> {
|
||||
typedef unsigned char Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<unsigned short> {
|
||||
typedef unsigned short Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<unsigned int> {
|
||||
typedef unsigned Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<unsigned long> {
|
||||
typedef unsigned long Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<unsigned long long> {
|
||||
typedef unsigned long long Type;
|
||||
};
|
||||
template<>
|
||||
struct MakeUnsigned<char> {
|
||||
typedef unsigned char Type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct MakeSigned {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<signed char> {
|
||||
typedef signed char Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<short> {
|
||||
typedef short Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<int> {
|
||||
typedef int Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<long> {
|
||||
typedef long Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<long long> {
|
||||
typedef long long Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<unsigned char> {
|
||||
typedef char Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<unsigned short> {
|
||||
typedef short Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<unsigned int> {
|
||||
typedef int Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<unsigned long> {
|
||||
typedef long Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeSigned<unsigned long long> {
|
||||
typedef long long Type;
|
||||
};
|
||||
template<>
|
||||
struct MakeSigned<char> {
|
||||
typedef signed char Type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct IsVoid : IsSame<void, typename RemoveCV<T>::Type> {
|
||||
|
|
Loading…
Add table
Reference in a new issue