I have two uchar4 struct : A and B.

Is there an instruction such that :

int res = dotProd(A,B )

or do I have to cast each field to int and then sum it :

int res = 0;

int ax = (int) a.x;

int bx = (int) b.x;

res += ax*bx;

…

thanks much

I have two uchar4 struct : A and B.

Is there an instruction such that :

int res = dotProd(A,B )

or do I have to cast each field to int and then sum it :

int res = 0;

int ax = (int) a.x;

int bx = (int) b.x;

res += ax*bx;

…

thanks much

I think on a hardware level it’ll all be the same. CUDA registers are all scalar and 32 bit.