Reputation: 1637
I want to use a u_int64_t
variable as search key.
Is u_int64_t
available on 32-bit machine?
If not, do I have to divide this variable into two variables? Then as a search key, it is a bit more troublesome.
Are there any workarounds for this?
Upvotes: 16
Views: 14980
Reputation: 3767
As per some of the documentation or reading its not quite clear __GLIBC_HAVE_LONG_LONG is the one that defines its presence in 32 bit architecture.
A probable solution for usage could be something similar to below:
#include <sys/types.h>
#ifdef __GLIBC_HAVE_LONG_LONG
u_int64_t i;
#endif
Oh by the way this is in Linux
Upvotes: 0
Reputation: 5836
Yes 64 bit integer datatype is supported on a 32 bit machine.
In C89 Standard , long long (≥ 64, ≥ size of long) type is supported as a GNU extension. In C99 standard, there is native support for long long(≥ 64, ≥ size of long) integer.
Upvotes: 5
Reputation: 155216
An unsigned 64-bit integral type is not guaranteed by the C standard, but is typically available on 32-bit machines, and on virtually all machines running Linux. When present, the type will be named uint64_t
(note one less underscore) and declared in the <stdint.h>
header file.
Upvotes: 18