From 30f9f31a69080edd1fbfcb98de34ff8320b78ee5 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Tue, 29 Jun 2021 10:24:09 +0200 Subject: [PATCH] DiscIO: Add workaround for MSVC ARM64 ICE --- Source/Core/DiscIO/WIABlob.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/Source/Core/DiscIO/WIABlob.h b/Source/Core/DiscIO/WIABlob.h index 8458ac95ee..bcd4c06b48 100644 --- a/Source/Core/DiscIO/WIABlob.h +++ b/Source/Core/DiscIO/WIABlob.h @@ -70,7 +70,7 @@ private: using SHA1 = std::array; using WiiKey = std::array; - // See docs/WIA.md for details about the format + // See docs/WiaAndRvz.md for details about the format #pragma pack(push, 1) struct WIAHeader1 @@ -241,25 +241,23 @@ private: struct ReuseID { - bool operator==(const ReuseID& other) const - { - return std::tie(partition_key, data_size, encrypted, value) == - std::tie(other.partition_key, other.data_size, other.encrypted, other.value); - } - bool operator<(const ReuseID& other) const - { - return std::tie(partition_key, data_size, encrypted, value) < - std::tie(other.partition_key, other.data_size, other.encrypted, other.value); - } - bool operator>(const ReuseID& other) const - { - return std::tie(partition_key, data_size, encrypted, value) > - std::tie(other.partition_key, other.data_size, other.encrypted, other.value); - } + // This is a workaround for an ICE in Visual Studio 16.10.0 when making an ARM64 Release build. + // Once the ICE has been fixed upstream, we can move partition_key inside the tie. +#define COMPARE_TIED(op) \ + (partition_key op other.partition_key) && \ + std::tie(data_size, encrypted, value) \ + op std::tie(other.data_size, other.encrypted, other.value) + + bool operator==(const ReuseID& other) const { return COMPARE_TIED(==); } + bool operator<(const ReuseID& other) const { return COMPARE_TIED(<); } + bool operator>(const ReuseID& other) const { return COMPARE_TIED(>); } + bool operator!=(const ReuseID& other) const { return !operator==(other); } bool operator>=(const ReuseID& other) const { return !operator<(other); } bool operator<=(const ReuseID& other) const { return !operator>(other); } +#undef COMPARE_TIED + const WiiKey* partition_key; u64 data_size; bool encrypted;