From 3ff464641a2602093d6cc21fdff035d9f89face0 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 23 Feb 2023 01:46:30 +0100 Subject: [PATCH] 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;". 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). --- rpcs3/util/atomic.hpp | 13 ++++++++----- rpcs3/util/media_utils.cpp | 3 --- rpcs3/util/media_utils.h | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rpcs3/util/atomic.hpp b/rpcs3/util/atomic.hpp index f26664001e..107ad6daf9 100644 --- a/rpcs3/util/atomic.hpp +++ b/rpcs3/util/atomic.hpp @@ -181,10 +181,13 @@ namespace atomic_wait } } any_value; - template ().observe())> + template + using payload_type = decltype(std::declval().observe()); + + template > constexpr u128 default_mask = sizeof(T) <= 8 ? u128{u64{umax} >> ((64 - sizeof(T) * 8) & 63)} : u128(-1); - template ().observe())> + template > 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 ().observe())> + template > constexpr void set_value(X& a, T value = T{}) { old = get_value(a, value); } - template ().observe())> + template > 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, T>(value); } - template ().observe())> + template > constexpr void set_mask() { mask = default_mask; diff --git a/rpcs3/util/media_utils.cpp b/rpcs3/util/media_utils.cpp index db002f6a0d..af1d99f853 100644 --- a/rpcs3/util/media_utils.cpp +++ b/rpcs3/util/media_utils.cpp @@ -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 diff --git a/rpcs3/util/media_utils.h b/rpcs3/util/media_utils.h index ee960528c0..31267ceb7f 100644 --- a/rpcs3/util/media_utils.h +++ b/rpcs3/util/media_utils.h @@ -1,15 +1,15 @@ #pragma once -#include -#include -#include -#include -#include #include "Utilities/StrUtil.h" #include "Utilities/Thread.h" #include "util/video_provider.h" #include "Emu/Cell/Modules/cellMusic.h" +#include +#include +#include +#include + namespace utils { std::string av_error_to_string(int error);