What are the dire consequences of accessing the fields of
You should not access the __m128i fields directly.
What are the dire consequences of accessing the fields directly?
The first consequence is portability: The contents of the
__m128i structure are not standardized. It is a 16-byte value stored on a 16-byte boundary, but that’s all that is required. If you go digging around inside it, you are tying yourself to a particular implementation’s definition of
The other consequence is performance: If a
__m128i value is in an XMM register, and you try to access a field from it, the compiler will store the XMM register to memory, so that it can then extract the appropriate field. If you want to pull out specific fields, you are better-served using an intrinsic if an applicable one is available.