mn416 / QPULib

Language and compiler for the Raspberry Pi GPU
Other
429 stars 64 forks source link

Summation of vector elements using QPULib #68

Open NazaninDelazimi opened 5 years ago

NazaninDelazimi commented 5 years ago

Hi, I use this code that you suggested befor but receive this error what is the problem ?

Int v; ... v = v + rotate(8, v); v = v + rotate(4, v); v = v + rotate(2, v); v = v + rotate(1, v);

D.cpp:13:20: error: call of overloaded ‘rotate(int, Int&)’ is ambiguous v = v + rotate(1, v); ^ In file included from ../Lib/QPULib.h:4:0, from ID.cpp:1: ../Lib/Source/Int.h:61:9: note: candidate: IntExpr rotate(IntExpr, IntExpr) IntExpr rotate(IntExpr a, IntExpr b); ^~ ../Lib/Source/Int.h:62:11: note: candidate: FloatExpr rotate(FloatExpr, IntExpr) FloatExpr rotate(FloatExpr a, IntExpr b);

thank you.

robiwano commented 5 years ago

The rotate functions takes operand to rotate as first argument, and amount to rotate as second, so:

v = v + rotate(v, 8);
v = v + rotate(v, 4);
v = v + rotate(v, 2);
v = v + rotate(v, 1);