Is there a way to shif the elements in a vector. Say I have int4, want to shift 4 element to the right for one position, with the left most one 0. So if int4={1,2,3,4}, the result is {0,1,2,3}.
The reason I am doing this is, I want to do a vector add (or other operation), but the elements need to be shifted.
Solved! Go to Solution.
Use the shuffle functions that are part of the OpenCL specification.
I guess xx>>1;
vec = (int4)(0, vec.xyz)
The shift will be dynamic, that is, I don't know how far it will be shifted, could be 1, 2, 3 elements away. Using xyzw does not quite help.
Use the shuffle functions that are part of the OpenCL specification.