convert u_int64_t to u_char (compile error) u_int64_t to u_char [7]

Hi, I have a problem with the following code:

__device__ void put_u64(void *vp, u_int64_t v)

{

	u_char *p = (u_char *) vp;

	p[0] = (u_char) (v >> 56) & 0xff;

	p[1] = (u_char) (v >> 48) & 0xff;

	p[2] = (u_char) (v >> 40) & 0xff;

	p[3] = (u_char) (v >> 32) & 0xff;

	p[4] = (u_char) (v >> 24) & 0xff;

	p[5] = (u_char) (v >> 16) & 0xff;

	p[6] = (u_char) (v >> 8) & 0xff;

	p[7] = (u_char) v & 0xff;

}

following compile-link error:

Assertion failure at line 1923 or …/…/be/cg/cgemit.cxx

incorrect register class for operand 0

nvopencc INTERNAL ERROR … status 1

(make emu=1 works nice)

can someone help pls - i just need a working way for

converting u_int64_t to a unsinged char[7].

CUDA 2.3 V0.2.1221 / 32bit linux

greets fta

It’s a char[8] your using. If you’ve declared it as a char[7] that might cause problems. I’d expect a slightly more useful error message though.

yes. sorry of course I used char[8]. I seems like (u_char) typecast does not work for (u_int64_t) (?)

We tried this on 2.3 under Linux, and we didn’t see any problems. You’ll need to post a full repro before we can investigate further.