Feature request for__float_as_unsignedint, __unsignedint_as_float CUDA:

Hello,

This is a request to CUDA language designers.

CUDA has two following type reinterpretation functions between float and int:
__float_as_int, __int_as_float

Would be nice to have unsigned int versions of them.

The reason is the following:

operation __float_as_int(f) >> 1
does integer division by 2, i.e. preserves sign.

In order to do logical shift, I need to cast to unsigned int:

(unsigned int)( __float_as_int(f) ) >> 1

__float_as_unsignedint() function would allow for cleaner code, since no cast is needed.

Thanks

deleted

__device__ unsigned int float_as_unsigned(float f)

{

}
__device__ unsigned int float_as_unsigned(float f)

{

}
__device__ unsigned int float_as_unsigned(float f)

{

    return (unsigned int)__float_as_int(f);

}

I suppose you could just use division for float? I kind of remember that while all cores can do float computation, only some cores support integer types… meaning if you do things in float only, you might get better utilization of the cores. Not sure if this is a faulty memory of mine, though.