mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
AK: Add MakeUnsigned<T> helper template
This commit is contained in:
parent
ca2052ae4a
commit
9a5dba9e09
Notes:
sideshowbarker
2024-07-19 07:34:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9a5dba9e099
1 changed files with 55 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue