(Editor's note: this question was originally: How should one access the m128i_i8 member, or members in general, of the __m128i object?, trying to use an MSVC-specific method on GCC's definition of __m128i
. But this was an XY problem and the accepted answer is about the XY problem here. Another answer does answer this question.)
I realize that Microsoft suggests against directly accessing the members of these objects, but I need to set them and the documentation is sorely lacking.
I continue getting the error "request for member ‘m128i_i8’ in ‘(my var name)', which is of non-class type ‘wirelabel {aka __vector(2) long long int}’" which I don't understand because I've included all the correct headers and it does recognize __m128i variables.
Note1: wirelabel is a typedef for __m128i i.e. there exists in a header
typedef __m128i wirelabel
Note2: The reason Note1 was used is explained in the following other question: tbb::cache_aligned_allocator: Getting "request for member...which is of non-class type" with __m128i. User error or bug?
Note3: I'm using the compiler g++
Note4: This following question doesn't answer mine but does discuss related information Why should you not access the __m128i fields directly?
I also know that there is a _mm_set_epi8 function but it requires you set all 8 bit sections at once and that is not an option for me currently.
The question the accepted answer answers:
Edit: I was asked for more specifics as to why I think I need to access each of the 16 8-bit parts of the __m128i
object, and here is why: I have a bool
array with size 'n*128' (n is a size_t) and I need to store these within an array of 'wirelabel' with size 'n'.
Now because wirelabel is just an alias/typedef (correct me if there is a difference) for __m128i, each of the 'n' indices of 128 bools can be stored in the 'wirelabel' array.
However, in order to do this I believe need to convert every 8-bits into its signed equivalent and store it in the correct 8bit index in each 'wirelabel' pointer in the array.