From 04efe12552982b7b3b4f7036cc1fb95606496a1c Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Wed, 11 Oct 2023 12:37:21 -0500 Subject: [PATCH] Fixing compilation problems on 32 Linux systems --- .../hpx/concurrency/detail/tagged_ptr_pair.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libs/core/concurrency/include/hpx/concurrency/detail/tagged_ptr_pair.hpp b/libs/core/concurrency/include/hpx/concurrency/detail/tagged_ptr_pair.hpp index cc2afb9f940f..e37c029598c3 100644 --- a/libs/core/concurrency/include/hpx/concurrency/detail/tagged_ptr_pair.hpp +++ b/libs/core/concurrency/include/hpx/concurrency/detail/tagged_ptr_pair.hpp @@ -26,7 +26,7 @@ namespace hpx::lockfree { uint128_type() = default; - constexpr uint128_type(std::uint64_t l, std::uint64_t r) noexcept + constexpr uint128_type(std::size_t l, std::size_t r) noexcept : left(l) , right(r) { @@ -52,11 +52,21 @@ namespace hpx::lockfree { } }; + namespace detail { + + template + inline constexpr std::size_t ptr_mask = 0xffffffffffff; + + template <> + inline constexpr std::size_t ptr_mask<4> = 0xffffffff; + } // namespace detail + template struct HPX_LOCKFREE_DCAS_ALIGNMENT tagged_ptr_pair { using compressed_ptr_pair_t = uint128_type; - using compressed_ptr_t = std::uint64_t; + // compressed_ptr_t must be of the same size as a pointer + using compressed_ptr_t = std::size_t; using tag_t = std::uint16_t; struct HPX_LOCKFREE_DCAS_ALIGNMENT cast_unit @@ -82,7 +92,8 @@ namespace hpx::lockfree { static constexpr std::size_t left_tag_index = 3; static constexpr std::size_t right_tag_index = 7; - static constexpr compressed_ptr_t ptr_mask = 0xffffffffffff; + static constexpr compressed_ptr_t ptr_mask = + detail::ptr_mask; static constexpr Left* extract_left_ptr( compressed_ptr_pair_t i) noexcept