shkurko_alexander

Problems with integer arithmetic in kernel code

Discussion created by shkurko_alexander on Jul 28, 2008
Latest reply on Aug 4, 2008 by shkurko_alexander

Hi,

I have the following kernel:

void Test(int Input<>,  out int Output<>
{

    int x = (int)0x80000000;

    Output = x;
}

After execution of this kernel at Output array I have 0x00000000.

If initialize x with (int)0x40000000, than at Output I have 0x40000000.

If inizialize x like this:

x = (int)0x40000000;

x = x << 1;

that at Output I have 0x80000000.

It initialize x with any value with 1 at last bit, I have 0x00000000 at Output

Is it a bug?

My system is Winwos XP (32bit), Radeon HD 3850, SDK 1.1

Thanks for the help,

Alexander Shkurko

Outcomes