You can use the macro:
UINT64_C
for defining 64-bit unsigned integers, the cstdint header provides macros for defining integer literals of certain sizes, we see that in section 18.4.1 Header Summary:
The header also defines numerous form macros:
and includes:
plus function type macros:
[U] INT {8 16 32 64 MAX} _C
We have to go back to the standard C99 project to find how they work, section 7.18.4.1 Macros for constants with a minimum width that state:
[...], if uint_least64_t is a name of type unsigned long long int, then UINT64_C (0x123) can expand to the integer constant 0x123ULL .
as the correct way to define a 64-bit integer constant expression. This, unfortunately, is not a cpprefernce document, but cplusplus.com documents this function for the cstdint header, as well as the cstdint link for stdint.h .
source share