Remove all remaining volatile qualifiers

This commit is contained in:
JosJuice
2021-05-13 19:30:30 +02:00
parent 41befc21cd
commit 8a0f5ea04a
11 changed files with 229 additions and 178 deletions

View File

@ -32,11 +32,6 @@
#include "Common/Inline.h"
#include "Common/Logging/Log.h"
// XXX: Replace this with std::is_trivially_copyable<T> once we stop using volatile
// on things that are put in savestates, as volatile types are not trivially copyable.
template <typename T>
constexpr bool IsTriviallyCopyable = std::is_trivially_copyable<std::remove_volatile_t<T>>::value;
// Wrapper class
class PointerWrap
{
@ -181,13 +176,13 @@ public:
DoArray(x.data(), static_cast<u32>(x.size()));
}
template <typename T, typename std::enable_if_t<IsTriviallyCopyable<T>, int> = 0>
template <typename T, typename std::enable_if_t<std::is_trivially_copyable_v<T>, int> = 0>
void DoArray(T* x, u32 count)
{
DoVoid(x, count * sizeof(T));
}
template <typename T, typename std::enable_if_t<!IsTriviallyCopyable<T>, int> = 0>
template <typename T, typename std::enable_if_t<!std::is_trivially_copyable_v<T>, int> = 0>
void DoArray(T* x, u32 count)
{
for (u32 i = 0; i < count; ++i)
@ -230,7 +225,7 @@ public:
template <typename T>
void Do(T& x)
{
static_assert(IsTriviallyCopyable<T>, "Only sane for trivially copyable types");
static_assert(std::is_trivially_copyable_v<T>, "Only sane for trivially copyable types");
// Note:
// Usually we can just use x = **ptr, etc. However, this doesn't work
// for unions containing BitFields (long story, stupid language rules)