Basically i need something like this:
#if (sizeof(int) * CHAR_BIT) == 32
INT_MASKS[32] = {
0x00000001, 0x00000003, 0x00000007, 0x0000000F,
0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF,
...
};
#elif (sizeof(int) * CHAR_BIT) == 64
INT_MASKS[64] = {
0x0000000100000001, 0x0000000300000003, 0x0000000700000007, 0x0000000F0000000F,
0x0000001F0000001F, 0x0000003F0000003F, 0x0000007F0000007F, 0x000000FF000000FF,
...
};
#else
#error unsupported architecture
#endif;
There’s more than only one array in each #if #else branch, so working equivalent would save me a lot of space. Also, some arrays contain loads of expressions, which i would like to evaluate during compilation. Thank you for any reply.
gcc et al define
__INT_MAX__– you could use this for gcc and gcc-compatible compilers and then maybe define it explicitly for any other compilers that you need to support: