Altera_Forum
Honored Contributor
11 years agoulong data type behaves as uint using emulator
Hi,
I have a problem with arithmetics using ulong values. E.g. I try to do something like this (it's an OpenCL code):
ulong A = 0;
A = A - 1; And I thought I should get 0xffffffffffffffff (64 ones), but I get 0xffffffff (32 ones). I've seen this code in OPRA example:
unsigned long count = bits;
count = ( count & 0x5555555555555555 ) + ( ( count >> 1 ) & 0x5555555555555555 ); which confirms the ability to work with 64b data types. On the other hand, when I try unsigned long long, everything works fine. OpenCL documentations states that ulong is a 64b data type, which I got confirmed using size_of(ulong). I'm currently using emulation (-march=emulator) - could it be the source of the problem?