mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
HLE_VarArgs: Replace enable_if with concepts.
This commit is contained in:
parent
81f620ba97
commit
a49514eb7b
@ -6,6 +6,7 @@
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
HLE::SystemVABI::VAList::~VAList() = default;
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
#include "Core/PowerPC/MMU.h"
|
||||
#include "Core/PowerPC/PowerPC.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
@ -19,15 +18,14 @@ class System;
|
||||
|
||||
namespace HLE::SystemVABI
|
||||
{
|
||||
// SFINAE
|
||||
template <typename T>
|
||||
constexpr bool IS_ARG_POINTER = std::is_union<T>() || std::is_class<T>();
|
||||
concept ArgPointer = std::is_union_v<T> || std::is_class_v<T>;
|
||||
template <typename T>
|
||||
constexpr bool IS_WORD = std::is_pointer<T>() || (std::is_integral<T>() && sizeof(T) <= 4);
|
||||
concept ArgWord = std::is_pointer_v<T> || (std::is_integral_v<T> && sizeof(T) <= 4);
|
||||
template <typename T>
|
||||
constexpr bool IS_DOUBLE_WORD = std::is_integral<T>() && sizeof(T) == 8;
|
||||
concept ArgDoubleWord = std::is_integral_v<T> && sizeof(T) == 8;
|
||||
template <typename T>
|
||||
constexpr bool IS_ARG_REAL = std::is_floating_point<T>();
|
||||
concept ArgReal = std::is_floating_point_v<T>;
|
||||
|
||||
// See System V ABI (SVR4) for more details
|
||||
// -> 3-18 Parameter Passing
|
||||
@ -47,7 +45,7 @@ public:
|
||||
virtual ~VAList();
|
||||
|
||||
// 0 - arg_ARGPOINTER
|
||||
template <typename T, typename std::enable_if_t<IS_ARG_POINTER<T>>* = nullptr>
|
||||
template <ArgPointer T>
|
||||
T GetArg()
|
||||
{
|
||||
T obj;
|
||||
@ -62,7 +60,7 @@ public:
|
||||
}
|
||||
|
||||
// 1 - arg_WORD
|
||||
template <typename T, typename std::enable_if_t<IS_WORD<T>>* = nullptr>
|
||||
template <ArgWord T>
|
||||
T GetArg()
|
||||
{
|
||||
static_assert(!std::is_pointer<T>(), "VAList doesn't support pointers");
|
||||
@ -84,7 +82,7 @@ public:
|
||||
}
|
||||
|
||||
// 2 - arg_DOUBLEWORD
|
||||
template <typename T, typename std::enable_if_t<IS_DOUBLE_WORD<T>>* = nullptr>
|
||||
template <ArgDoubleWord T>
|
||||
T GetArg()
|
||||
{
|
||||
u64 value;
|
||||
@ -107,7 +105,7 @@ public:
|
||||
}
|
||||
|
||||
// 3 - arg_ARGREAL
|
||||
template <typename T, typename std::enable_if_t<IS_ARG_REAL<T>>* = nullptr>
|
||||
template <ArgReal T>
|
||||
T GetArg()
|
||||
{
|
||||
double value;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user