error: no operator "-" matches these operands. operand types are: ushort1 - int. Cuda 5.0

I have run into a problem getting a program to compile for cuda-5.0. I get the following error:

energy.cu(204): error: no operator “-” matches these operands
operand types are: ushort1 - int

Here is line energy.cu(204): ibead = ibead_bnd[i] - 1;

ibead_bnd[i] is of type ushort1 so the “-” operator will not work. However, I try casting ibead_bnd[i] to an int and I get an error that says there is no suitable conversion from ushort1 to int.

It seems like I’m in a catch 22. Does anyone know of a workaround for this? Thank you in advance for any help.

A ushort1 is a struct with an x field. You should be writing:

ibead = ibead_bnd[i].x - 1;

Do you really want the “ushort1” type instead of just “unsigned short”?

I guess either will work fine. As long as it is a ushort it should work for me. Thank you for your help, this solved my problem.