64 bit integer and structures

Does exist a 64 bit integer data type in CUDA? And… can I use structures like “STRUCT” and “UNION”?

I have to work with an equivalent structure of this:

union magic {

  struct {

	ogg_int32_t lo;

	ogg_int32_t hi;

  } halves;

  ogg_int64_t whole;


ogg_int32_t and ogg_int64_t are equivalent respectively to a 32 and 64 bit integer

About the significance of bits… nvidia memory cards adopts a little or big endian notation? (Notice that the value of “lo” and “hi” in the struct wuold be different and it should be inverted eventually)

Besides… I’ve read (somewhere) that shifting is possible… if unions aren’t usable… can I take 32 bit of the 64 bit integer using a shifting on the last one followed by ad 32 integer cast?

Thx to all

Yes, there does appear to be a 64 bit integer type in CUDA, though it’s not obvious to me whether it requires compute capability 1.3 (which is required for 64-bit floats). Structs are fine, bit shifting is fine, and though I’ve never used a union, I don’t see why that wouldn’t work too.

I see you are parsing the Ogg container format… Out of curiosity, what project are you working on? (I used to maintain ogg123 in a previous life.)

64-bit integers are supported on all hardware.

… and you can easily access hi/lo words of 64-bit word without using structs (which are likely to be placed in local mem),

e.g., packing:
uint64 x = __double_as_longlong(__hiloint2double(hi, lo));

hi = __double2hiint(__longlong_as_double(x));
lo = __double2loint(__longlong_as_double(x));

internally uint64 is stored in 2 registers,
so these constructions produce efficient code