Type constructor <=> casting in a kernel?


Sorry if this is obvious, I can’t seem to find any official docs indicating whether I can use equivalently a type constructor in a kernel instead of casting:

int intValue = (int) floatValue <=> int intValue = int(floatValue) ?

The latter one seems to work, is this fully supported?

Hi, perhaps this is no CUDA function. Looks like a constructor like c function to initalize integer variables.

Cast inside kernel?

I alway use static_cast for casting a value, and reinterpret_cast for casting pointer in side kernel.

You can do like this

int intValue = static_cast(floatValue);

int intPointer = reinterpret_cast<int>(floatPointer);