mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 20:33:10 +00:00
AK: Add MakeUnsigned<T> helper template
This commit is contained in:
parent
ca2052ae4a
commit
9a5dba9e09
|
@ -316,6 +316,60 @@ inline constexpr T&& forward(typename RemoveReference<T>::Type&& param) noexcept
|
|||
return static_cast<T&&>(param);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct MakeUnsigned {
|
||||
};
|
||||
|
||||
template<>
|
||||
struct MakeUnsigned<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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using AK::ceil_div;
|
||||
|
@ -324,6 +378,7 @@ using AK::Conditional;
|
|||
using AK::exchange;
|
||||
using AK::forward;
|
||||
using AK::IsSame;
|
||||
using AK::MakeUnsigned;
|
||||
using AK::max;
|
||||
using AK::min;
|
||||
using AK::move;
|
||||
|
|
Loading…
Reference in a new issue