summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2023-12-13 18:39:22 +0000
committerGitHub <noreply@github.com>2023-12-13 18:39:22 +0000
commitcdf4193e67680b2dab1b1af352e7d61007adfc19 (patch)
treeb3d41481bd4243c5c68ed5e8f0b18172ac3648e0 /Source
parentb5d8498346b5de1b332a2777c3d041f143ed9c30 (diff)
parentdbc792a3ec9bccdb21765dd052ce92c61bdeb6d2 (diff)
Merge pull request #12410 from lioncash/ignored
Common/Crypto: Resolve -Wignored-attributes warnings
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Common/Crypto/AES.cpp14
-rw-r--r--Source/Core/Common/Crypto/SHA1.cpp17
2 files changed, 28 insertions, 3 deletions
diff --git a/Source/Core/Common/Crypto/AES.cpp b/Source/Core/Common/Crypto/AES.cpp
index 3fc9a80a56..272341ecca 100644
--- a/Source/Core/Common/Crypto/AES.cpp
+++ b/Source/Core/Common/Crypto/AES.cpp
@@ -250,7 +250,19 @@ public:
}
private:
- std::array<__m128i, NUM_ROUND_KEYS> round_keys;
+ // Ensures alignment specifiers are respected.
+ struct XmmReg
+ {
+ __m128i data;
+
+ XmmReg& operator=(const __m128i& m)
+ {
+ data = m;
+ return *this;
+ }
+ operator __m128i() const { return data; }
+ };
+ std::array<XmmReg, NUM_ROUND_KEYS> round_keys;
};
#endif
diff --git a/Source/Core/Common/Crypto/SHA1.cpp b/Source/Core/Common/Crypto/SHA1.cpp
index 57c45b09f3..f87bbd2c6d 100644
--- a/Source/Core/Common/Crypto/SHA1.cpp
+++ b/Source/Core/Common/Crypto/SHA1.cpp
@@ -166,7 +166,20 @@ public:
}
private:
- using WorkBlock = CyclicArray<__m128i, 4>;
+ struct XmmReg
+ {
+ // Allows aliasing attributes to be respected in the
+ // face of templates.
+ __m128i data;
+
+ XmmReg& operator=(const __m128i& d)
+ {
+ data = d;
+ return *this;
+ }
+ operator __m128i() const { return data; }
+ };
+ using WorkBlock = CyclicArray<XmmReg, 4>;
ATTRIBUTE_TARGET("ssse3")
static inline __m128i byterev_16B(__m128i x)
@@ -244,7 +257,7 @@ private:
virtual bool HwAccelerated() const override { return true; }
- std::array<__m128i, 2> state{};
+ std::array<XmmReg, 2> state{};
};
#endif