Is there any c compiler on windows able to use 128 bit integers natively? On example, you can use gcc on linux, with __uint128_t... any other chance on windows? (It would be great if 128 bit worked on 32 bit computers as well! :D)
Matteo
Software. In the same way that compilers emulate e.g. 64-bit integer arithmetic on architectures with register sizes less than 64 bits, some compilers also support 128-bit integer arithmetic. For example, the GCC C compiler 4.6 and later has a 128-bit integer type __int128 for some architectures.
Simply write __int128 for a signed 128-bit integer, or unsigned __int128 for an unsigned 128-bit integer. There is no support in GCC for expressing an integer constant of type __int128 for targets with long long integer less than 128 bits wide.
128-bit refers to one hundred twenty-eight binary (0 or 1) units of integer data. This allows for up to 340,282,366,920,938,463,463,374,607,431,768,211,456 combinations of values.
The 128-bit data type can handle up to 31 significant digits (compared to 17 handled by the 64-bit long double). However, while this data type can store numbers with more precision than the 64-bit data type, it does not store numbers of greater magnitude.
In GCC you can try __attribute__((mode(...)))
, see here and here, e.g.
typedef unsigned int myU128 __attribute__((mode(TI)));
The results depend on your platform, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With