On Linux and Mac, one can do
__m128 x;
__m128i n = (__m128i)x;
This operation copies the bit representation of x to n, and is useful for implementing various branch-free conditional operations operating on SSE floating point registers. On MSVC 11, it gives
eikonal-generated.h(1228) : error C2440: 'type cast' : cannot convert from '__m128' to '__m128i'; No constructor could take the source type, or constructor overload resolution was ambiguous
What is the equivalent in Microsoft Visual Studio?
Note that I am not asking for the standard float-to-int conversion function _mm_cvtepi32_ps, which does numerically meaningful conversion.
With MSVC you need to use:
_mm_castsi128_ps for bitwise cast from __m128i
to __m128
and
_mm_castps_si128 for bitwise cast from __m128
to __m128i
For other compilers (gcc, ICC, et al) you can just use normal casts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With