boostorg / winapi

Windows API declarations without <windows.h>, for internal Boost use.
62 stars 58 forks source link

Fix issue #76, use intrinsics on x86, ARM & ARM64 #77

Closed wyattoday closed 5 years ago

Lastique commented 5 years ago

I don't think this is correct wrt. _M_ARM and _M_IX86. As I remember, at least some MSVC versions don't provide pointer intrinsics on 32-bit targets.

wyattoday commented 5 years ago

It's been available for x86 since at least Visual Studio 2015. So, perhaps modify the #ifdef to include that:

|| (BOOST_MSVC >= 1900 && defined(_M_IX86))

Also, as far as I can see for every MSVC that supports targeting ARM (32-bit arm), that intrinsic has been available. So, that part of the ifdef shouldn't have been chopped out.

Lastique commented 5 years ago

Also, as far as I can see for every MSVC that supports targeting ARM (32-bit arm), that intrinsic has been available.

intrin.h in MSVC-10 contains checks for _M_ARM but doesn't define _InterlockedCompareExchangePointer for that platform.

wyattoday commented 5 years ago

Well, MSDN documentation doesn't explicitly say when they made it available, so I'd be happy with a VS 2015 check for both x86 / ARM:

|| (BOOST_MSVC >= 1900 && (defined(_M_IX86) || defined(_M_ARM)))

People using modern compilers will get the benefit of the intrinsics.

Lastique commented 5 years ago

To be clear, there is no benefit from using pointer intrinsics compared to the properly sized integer intrinsics. I'll add compiler version checks, though.