Hi,
I’ve a strange error using structure stored in local memory.
[codebox]
template
struct Integer {
uint _used;
uint _mp_d[(N & 0x10 ? (N >> 4)+1 : (N >> 4))];
};
global {…} (uint* _d){
Integer<N> x;
Integer<N> y;
Integer<N> res;
uint carry = 0;
//x and y are load from global memory
[...]
uint maxsize = max(...);
for(int i = 0; i < maxsize; i++) {
uint add = x._mp_d[i]+ y._mp_d[i]+carry;
res._mp_d[i] = add & 0xFFFF;
carry = add >> 16;
}
[...]
_d[0] = res._used;
_d[1] = res._mp_d[0];
}
[/codebox]
The code doesn’t compile the two last lines, and I’ve an error :
The strangest is when I use this code in device function, all instructions "res._mp_d[i] = " or "res._used = " cause the same error…
I only found one topic about this error, without real solution. Someone can help me ?
Thank you
Solved. The array in the structure has to be “create” in a function.
MrDX
3
Can you describe, how you solved that problem. I have the same problem now in some situtations. It’s a strange error.
MrDX
4
I updated to 2.2. It seems to be fixed there.