1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 12:42:41 +01:00

Fix Visual Studio 17.5.0 compilation

For some reason there's an internal compiler error related to atomic wait.
I could work around this issue when I commented "mask = default_mask<X>;".
So after playing around a bit I had the suspicion that the VS parser can't handle some of the templatization.
Giving the decltype its own alias seems to fix this issue (and makes the code a bit more readable anyway in my opinion).
This commit is contained in:
Megamouse 2023-02-23 01:46:30 +01:00 committed by Ivan
parent 7cb3d305d4
commit 3ff464641a
3 changed files with 13 additions and 13 deletions

View File

@ -181,10 +181,13 @@ namespace atomic_wait
}
} any_value;
template <typename X, typename T = decltype(std::declval<X>().observe())>
template <typename X>
using payload_type = decltype(std::declval<X>().observe());
template <typename X, typename T = payload_type<X>>
constexpr u128 default_mask = sizeof(T) <= 8 ? u128{u64{umax} >> ((64 - sizeof(T) * 8) & 63)} : u128(-1);
template <typename X, typename T = decltype(std::declval<X>().observe())>
template <typename X, typename T = payload_type<X>>
constexpr u128 get_value(X&, T value = T{}, ...)
{
static_assert((sizeof(T) & (sizeof(T) - 1)) == 0);
@ -199,13 +202,13 @@ namespace atomic_wait
u128 old;
u128 mask;
template <typename X, typename T = decltype(std::declval<X>().observe())>
template <typename X, typename T = payload_type<X>>
constexpr void set_value(X& a, T value = T{})
{
old = get_value(a, value);
}
template <typename X, typename T = decltype(std::declval<X>().observe())>
template <typename X, typename T = payload_type<X>>
constexpr void set_mask(T value)
{
static_assert((sizeof(T) & (sizeof(T) - 1)) == 0);
@ -213,7 +216,7 @@ namespace atomic_wait
mask = std::bit_cast<get_uint_t<sizeof(T)>, T>(value);
}
template <typename X, typename T = decltype(std::declval<X>().observe())>
template <typename X, typename T = payload_type<X>>
constexpr void set_mask()
{
mask = default_mask<X>;

View File

@ -1,8 +1,5 @@
#include "stdafx.h"
#include "media_utils.h"
#include "logs.hpp"
#include "Utilities/StrUtil.h"
#include "Emu/Cell/Modules/cellSearch.h"
#include "Emu/System.h"
#include <random>

View File

@ -1,15 +1,15 @@
#pragma once
#include <unordered_map>
#include <atomic>
#include <deque>
#include <mutex>
#include <thread>
#include "Utilities/StrUtil.h"
#include "Utilities/Thread.h"
#include "util/video_provider.h"
#include "Emu/Cell/Modules/cellMusic.h"
#include <unordered_map>
#include <deque>
#include <mutex>
#include <thread>
namespace utils
{
std::string av_error_to_string(int error);