Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.

I have a question.

Threre is the data what the type is __m128i.

And I want to copy to BYTE array.

For example)

__m128i result;

__m128i.m128i_u8[0] = 1;
__m128i.m128i_u8[1] = 2;
__m128i.m128i_u8[2] = 3;
__m128i.m128i_u8[3] = 4;
__m128i.m128i_u8[4] = 5;
__m128i.m128i_u8[5] = 6;
__m128i.m128i_u8[6] = 7;
__m128i.m128i_u8[7] = 8;
__m128i.m128i_u8[8] = 0;
__m128i.m128i_u8[9] = 0;
__m128i.m128i_u8[10] = 0;
__m128i.m128i_u8[11] = 0;
__m128i.m128i_u8[12] = 0;
__m128i.m128i_u8[13] = 0;
__m128i.m128i_u8[14] = 0;
__m128i.m128i_u8[15] = 0;

BYTE data[8] = {0,};

memcpy(data,__m128i.m128i_u8,8);

Result)
data[0] = 1;
data[1] = 2;
data[2] = 3;
data[3] = 4;
data[4] = 5;
data[5] = 6;
data[6] = 7;
data[7] = 8;

Actually, I test as above code, it works well but slow.
I think because of 'memcpy'.

I want to replace from 'memcpy' to '_mm_store...' operation.
I think it will work faster than 'memcpy'. (maybe..)

So my question is...
How to use '_mm_store...' operation, can I get as above result?

Please advise me. Thank you :)

What I have tried:

I tried to use 'memcpy'.

memcpy(data,__m128i.m128i_u8,8); // slow..
Posted
Updated 11-Apr-16 22:07pm

1 solution

See __m128i[^] for an explanation of why you should not do this.
 
Share this answer
 
Comments
kgg124 12-Apr-16 5:25am    
Thank you for your reply.
So.. Can not do this 'memcpy(data,__m128i.m128i_u8,8)' ?

I am trying to sobel filter image by using SSE operations now.
How can I make processed image data?

I have been using 'memcpy', and it works well..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900