brook gives error...

I need to zero last few bits in float number before int cast (last bits contain noise that should be eliminated before type conversion).

In CPU code I use:

float tmp=thresh_x *(float) sqrt((float)2.0 *(float) ncb);

unsigned tmp1=((*(unsigned*)(&tmp))&0xFFFFF000);

thresh_tbl = ncb + (int)( *((float*)(&tmp1)) );

But this gives error inside kernel:

Operator not supported in kernel: variable address(&)

Statement: &tmp in tmp1 = *((uint *) &tmp) & 0xfffff000

and

Operator not supported in kernel: pointer dereference(*)

Statement: *((uint *) &tmp) in tmp1 = *((uint *) &tmp) & 0xfffff000

and

ERROR--3: In Binary expression: implicit conversion from right type to left type

Statement: *((uint *) &tmp) & 0xfffff000 in tmp1 = *((uint *) &tmp) & 0xfffff000

Expression : *((uint *) &tmp), Type : uint

Expression : 0xfffff000, Type : int

Is it possible to do such bit zeroing inside GPU kernel?

Maybe some another way ?

I need to zero last few bits in float number before int cast (last bits contain noise that should be eliminated before type conversion).

In CPU code I use:

float tmp=thresh_x *(float) sqrt((float)2.0 *(float) ncb);

unsigned tmp1=((*(unsigned*)(&tmp))&0xFFFFF000);

thresh_tbl = ncb + (int)( *((float*)(&tmp1)) );

But this gives error inside kernel:

Operator not supported in kernel: variable address(&)

Statement: &tmp in tmp1 = *((uint *) &tmp) & 0xfffff000

and

Operator not supported in kernel: pointer dereference(*)

Statement: *((uint *) &tmp) in tmp1 = *((uint *) &tmp) & 0xfffff000

and

ERROR--3: In Binary expression: implicit conversion from right type to left type

Statement: *((uint *) &tmp) & 0xfffff000 in tmp1 = *((uint *) &tmp) & 0xfffff000

Expression : *((uint *) &tmp), Type : uint

Expression : 0xfffff000, Type : int

Is it possible to do such bit zeroing inside GPU kernel?

Maybe some another way ?

Isn't it working if you disable strong type checking (it's a bit annoying at times) just omit all those type conversion and simply do the binary AND?

float temp = some_value_or_expression;

tresh_tbl = ncb + (int)(temp & 0xfffff000);

Looks much simpler to me and for the hardware it shouldn't matter.