We can use the preprocessor to know if unsigned long long
is defined:
#include <limits.h>
#ifndef ULLONG_MAX
typedef unsigned long t_mask;
#else
typedef unsigned long long t_mask;
#endif
But how to know if __uint128_t
is defined?
We can use the preprocessor to know if unsigned long long
is defined:
#include <limits.h>
#ifndef ULLONG_MAX
typedef unsigned long t_mask;
#else
typedef unsigned long long t_mask;
#endif
But how to know if __uint128_t
is defined?
Since the __uint128_t
type is a GCC extension, the proper thing to do is probably to check for some known-good version of GCC.
See this page for information about the macros used to version-check the GCC compiler.
You can try the following. I do not know how reliable this is, but it might be the easiest way.