uint64_t to int

mkn picture mkn · Jul 21, 2010 · Viewed 18.1k times · Source

I'm writing a java binding for a C code and I'm not really familiar with C.

I have a uint64_t and need to cast it to a int. Does anyone know how to do that? (My binding returns then a jint...)

Answer

Macmade picture Macmade · Jul 21, 2010

Usually, using an exact width integer like 'uint64_t' is for a good reason. If you cast it to an int, which may not be 64bits long, you may have serious problems...