Ternary operation for vector (select)

Discussion created by deNorma on Jun 30, 2010
Latest reply on Jun 30, 2010 by Illusio
Hi, I want to know how to use the ternary operator for vector in openCL. I think it should be 'select', in the specification:

page 219

say, I have a float4 for each work-item(thread)

float4 a,b,c;
// I want to do this for every component, i.e. x,  y, z, w
if (a.x*b.x>0)

I think writing it like this will slow down the program. I tried to use 'select', to just use one line, but don't know how... Could anyone give me an example?

Thank you very much.