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?
You can try the following. I do not know how reliable this is, but it might be the easiest way.
#ifdef __SIZEOF_INT128__
// do some fancy stuff here
#else
// do some fallback stuff here
#endif