开发者

logical shift in CUDA

rshift = ((J[i]-1)*((2*net)-J[i]) >> -1);

L[i] = rshift + K[i]-J[i];

when i compile this, i get "error: expression must have integral or enum type" corresponding to the first line. except for 'i' all have double precision.

it works for neither left nor right shift. i'm using fedora 12 and i have nvcc 3.2, V0.2.1221. for c++(g++ compiler), it works perfectly.

but when i tried it for

rshift = ((J[i]-1)*((2*net)-J[i]) >>= -1);

L[i] = rshift + K[i]-J[i];

it was "error: expression must be a modifia开发者_运维百科ble lvalue" i tried a lot and couldn't fix it. any ideas?


To answer the question - there is no such thing as bit shifting of floating point types in CUDA C (nor C, nor C++). And through questions posted in comments it would appear that the source of the confusion was an incorrect attempt to translate some legacy Fortran code, where there also is no floating point bit shift support.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜