From 61fbfe31cb18ffc924bc9ed12a1d9564a651305a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Heusipp?= Date: Mon, 2 Oct 2023 07:40:24 +0000 Subject: [PATCH] Merged revision(s) 19809 from trunk/OpenMPT: [Fix] Crypto++: Work-around by partially reverting . ........ git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.31@19810 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- include/cryptopp/OpenMPT.txt | 4 ++++ include/cryptopp/cpu.cpp | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/cryptopp/OpenMPT.txt b/include/cryptopp/OpenMPT.txt index 598e9672a39..8784213a8e5 100644 --- a/include/cryptopp/OpenMPT.txt +++ b/include/cryptopp/OpenMPT.txt @@ -1,5 +1,9 @@ cryptp++ library version 8.9.0 (2023-10-01). The following changes have been made: + * `cpu.c`has been fixed for MSVC x64 builds. See + and + . + * Modifications are marked by `// OpenMPT` or `/* OpenMPT */`. * Obviously, unnecessary folders and files have been removed. * For building, premake is used to generate Visual Studio project files. See ../build/premake/ for details. diff --git a/include/cryptopp/cpu.cpp b/include/cryptopp/cpu.cpp index ab25bea9f1f..2ad3b46f4c4 100644 --- a/include/cryptopp/cpu.cpp +++ b/include/cryptopp/cpu.cpp @@ -392,7 +392,11 @@ word64 XGetBV(word32 num) // Use it for all MSVC-compatible compilers. #if defined(_M_X64) && defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) +#if defined(CRYPTOPP_MSC_VERSION) && (_MSC_FULL_VER >= 160040219) /* OpenMPT */ + return _xgetbv(num); /* OpenMPT */ +#else /* OpenMPT */ return XGETBV64(num); +#endif /* OpenMPT */ // Required by Visual Studio 2008 and below and Clang on Windows. // Use it for all MSVC-compatible compilers. @@ -450,8 +454,13 @@ bool CpuId(word32 func, word32 subfunc, word32 output[4]) // Use it for all MSVC-compatible compilers. #if defined(_M_X64) && defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) +#if defined(CRYPTOPP_MSC_VERSION) && ((CRYPTOPP_MSC_VERSION >= 1600)) /* OpenMPT */ + __cpuidex((int *)output, func, subfunc); /* OpenMPT */ + return true; /* OpenMPT */ +#else /* OpenMPT */ CPUID64(func, subfunc, output); return true; +#endif /* OpenMPT */ // Required by Visual Studio 2008 and below and Clang on Windows. // Use it for all MSVC-compatible compilers.