vcpkg/ports/boost-json/0001-Fix-use-of-intrinsics-on-windows-ARM-platforms.patch
2023-09-13 15:40:46 -07:00

45 lines
1.6 KiB
Diff

From c4ce8509d015a0b75cfa9d36609b8409821a9c86 Mon Sep 17 00:00:00 2001
From: Matt Borland <matt@mattborland.com>
Date: Fri, 11 Aug 2023 09:20:47 -0400
Subject: [PATCH 1/2] Fix use of intrinsics on windows ARM platforms
---
.../json/detail/charconv/detail/emulated128.hpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/boost/json/detail/charconv/detail/emulated128.hpp b/include/boost/json/detail/charconv/detail/emulated128.hpp
index 3a1a392..6eadbc7 100644
--- a/include/boost/json/detail/charconv/detail/emulated128.hpp
+++ b/include/boost/json/detail/charconv/detail/emulated128.hpp
@@ -58,11 +58,15 @@ struct uint128
static inline std::uint64_t umul64(std::uint32_t x, std::uint32_t y) noexcept
{
-#if defined(BOOST_JSON_HAS_MSVC_32BIT_INTRINSICS)
+ #if defined(BOOST_JSON_HAS_MSVC_32BIT_INTRINSICS) && !defined(_M_ARM64)
+
return __emulu(x, y);
-#else
+
+ #else
+
return x * static_cast<std::uint64_t>(y);
-#endif
+
+ #endif
}
// Get 128-bit result of multiplication of two 64-bit unsigned integers.
@@ -73,7 +77,7 @@ BOOST_JSON_SAFEBUFFERS inline uint128 umul128(std::uint64_t x, std::uint64_t y)
auto result = static_cast<boost::uint128_type>(x) * static_cast<boost::uint128_type>(y);
return {static_cast<std::uint64_t>(result >> 64), static_cast<std::uint64_t>(result)};
- #elif defined(BOOST_JSON_HAS_MSVC_64BIT_INTRINSICS)
+ #elif defined(BOOST_JSON_HAS_MSVC_64BIT_INTRINSICS) && !defined(_M_ARM64)
std::uint64_t high;
std::uint64_t low = _umul128(x, y, &high);
--
2.38.1.windows.1