From 7560456f8da3abe94dd9692dc9896cbb9767cf4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 15 Feb 2014 00:14:43 +0100 Subject: [PATCH] Workaround for MSVC20013 x64 --- include/boost/interprocess/offset_ptr.hpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/include/boost/interprocess/offset_ptr.hpp b/include/boost/interprocess/offset_ptr.hpp index 60faf0d..3f52c93 100644 --- a/include/boost/interprocess/offset_ptr.hpp +++ b/include/boost/interprocess/offset_ptr.hpp @@ -75,9 +75,11 @@ namespace ipcdetail { // //////////////////////////////////////////////////////////////////////// #define BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR - #define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR - #define BOOST_INTERPROCESS_OFFSET_PTR_USE_NEG_MASK - + #if defined(_MSC_VER) && (_MSC_VER >= 1700) && (defined(_M_AMD64) || defined(_M_X64)) + //Visual 2013 x64 optimizes more than we desire, so disable branchless option + #else + #define BOOST_INTERPROCESS_OFFSET_PTR_BRANCHLESS_TO_PTR + #endif template #ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR BOOST_INTERPROCESS_NEVER_INLINE @@ -98,11 +100,7 @@ namespace ipcdetail { #else const caster_t caster((void*)this_ptr); std::size_t target_offset = caster.size() + offset; - #ifdef BOOST_INTERPROCESS_OFFSET_PTR_USE_NEG_MASK std::size_t mask = -std::size_t(offset != 1); - #else - std::size_t mask = (offset != 1) ? std::size_t(-1) : std::size_t(0); - #endif target_offset &= mask; return caster_t(target_offset).pointer(); #endif