Imagine that, after some SIMD calculations, I get a __m128i value with the fourth field with a useless zero value. Is there a simple and portable way to cast the other three fields into a std::tuple<int,int,int>, bearing in mind it is not standard layout?
Ugly, but portable. I don't believe, that there is fast solution, since std::tuple does not have defined memory layout. So just copying those three values into a tuple.
std::tuple<int, int, int> to_tuple(__m128i& value)
{
auto* ptr = reinterpret_cast<int*>(&value);
return std::make_tuple(ptr[0], ptr[1], ptr[2]);
}
Why do you need this? Maybe you can get around your problem some other way.
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