yuzu/externals/vcpkg/ports/qtwebengine/0ce5e91.diff
2022-07-23 03:01:36 +02:00

95 lines
4.5 KiB
Diff
Executable File

From 0ce5e91bdfa2cd7cac247911b9e8c4404c114937 Mon Sep 17 00:00:00 2001
From: Peter Varga <pvarga@inf.u-szeged.hu>
Date: Thu, 21 Apr 2022 08:49:53 +0200
Subject: [PATCH] Workaround MSVC2022 ICE in constexpr functions
It happens around initialization of STL containers in a constexpr
function. In this case, aggregate initialization of std::array with
double braces seems to cause the crash.
For some reason it doesn't seem to happen in 98-based. This workaround
can be reverted after Microsoft fixes the issue:
https://developercommunity.visualstudio.com/t/fatal-error-C1001:-Internal-compiler-err/1669485
Change-Id: I6bc2c71d328691cc74bc53c6d62f3d5df519b81e
Pick-to: 90-based
Fixes: QTBUG-101917
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
---
diff --git a/chromium/base/hash/md5_constexpr_internal.h b/chromium/base/hash/md5_constexpr_internal.h
index b705bc8..5c9c004 100644
--- a/chromium/base/hash/md5_constexpr_internal.h
+++ b/chromium/base/hash/md5_constexpr_internal.h
@@ -281,15 +281,63 @@
return IntermediateDataToMD5Digest(ProcessMessage(data, n));
}
- static constexpr uint64_t Hash64(const char* data, uint32_t n) {
- IntermediateData intermediate = ProcessMessage(data, n);
- return (static_cast<uint64_t>(SwapEndian(intermediate.a)) << 32) |
- static_cast<uint64_t>(SwapEndian(intermediate.b));
+ static constexpr uint64_t Hash64(const char* message, uint32_t n) {
+ const uint32_t m = GetPaddedMessageLength(n);
+ IntermediateData intermediate0 = kInitialIntermediateData;
+ for (uint32_t offset = 0; offset < m; offset += 64) {
+ RoundData data = {
+ GetPaddedMessageWord(message, n, m, offset),
+ GetPaddedMessageWord(message, n, m, offset + 4),
+ GetPaddedMessageWord(message, n, m, offset + 8),
+ GetPaddedMessageWord(message, n, m, offset + 12),
+ GetPaddedMessageWord(message, n, m, offset + 16),
+ GetPaddedMessageWord(message, n, m, offset + 20),
+ GetPaddedMessageWord(message, n, m, offset + 24),
+ GetPaddedMessageWord(message, n, m, offset + 28),
+ GetPaddedMessageWord(message, n, m, offset + 32),
+ GetPaddedMessageWord(message, n, m, offset + 36),
+ GetPaddedMessageWord(message, n, m, offset + 40),
+ GetPaddedMessageWord(message, n, m, offset + 44),
+ GetPaddedMessageWord(message, n, m, offset + 48),
+ GetPaddedMessageWord(message, n, m, offset + 52),
+ GetPaddedMessageWord(message, n, m, offset + 56),
+ GetPaddedMessageWord(message, n, m, offset + 60)};
+ IntermediateData intermediate1 = intermediate0;
+ for (uint32_t i = 0; i < 64; ++i)
+ intermediate1 = ApplyStep(i, data, intermediate1);
+ intermediate0 = Add(intermediate0, intermediate1);
+ }
+ return (static_cast<uint64_t>(SwapEndian(intermediate0.a)) << 32) |
+ static_cast<uint64_t>(SwapEndian(intermediate0.b));
}
- static constexpr uint32_t Hash32(const char* data, uint32_t n) {
- IntermediateData intermediate = ProcessMessage(data, n);
- return SwapEndian(intermediate.a);
+ static constexpr uint32_t Hash32(const char* message, uint32_t n) {
+ const uint32_t m = GetPaddedMessageLength(n);
+ IntermediateData intermediate0 = kInitialIntermediateData;
+ for (uint32_t offset = 0; offset < m; offset += 64) {
+ RoundData data = {
+ GetPaddedMessageWord(message, n, m, offset),
+ GetPaddedMessageWord(message, n, m, offset + 4),
+ GetPaddedMessageWord(message, n, m, offset + 8),
+ GetPaddedMessageWord(message, n, m, offset + 12),
+ GetPaddedMessageWord(message, n, m, offset + 16),
+ GetPaddedMessageWord(message, n, m, offset + 20),
+ GetPaddedMessageWord(message, n, m, offset + 24),
+ GetPaddedMessageWord(message, n, m, offset + 28),
+ GetPaddedMessageWord(message, n, m, offset + 32),
+ GetPaddedMessageWord(message, n, m, offset + 36),
+ GetPaddedMessageWord(message, n, m, offset + 40),
+ GetPaddedMessageWord(message, n, m, offset + 44),
+ GetPaddedMessageWord(message, n, m, offset + 48),
+ GetPaddedMessageWord(message, n, m, offset + 52),
+ GetPaddedMessageWord(message, n, m, offset + 56),
+ GetPaddedMessageWord(message, n, m, offset + 60)};
+ IntermediateData intermediate1 = intermediate0;
+ for (uint32_t i = 0; i < 64; ++i)
+ intermediate1 = ApplyStep(i, data, intermediate1);
+ intermediate0 = Add(intermediate0, intermediate1);
+ }
+ return SwapEndian(intermediate0.a);
}
};