Search code examples
cgccx86-64128-bitextended-precision

Does gcc support 128-bit int on amd64?


Does gcc support 128-bit int on amd64?

How to define it?

How to use scanf/printf to read/write it?


Solution

  • GCC supports built-in __int128 and unsigned __int128 types (on 64-bit platforms only), but it looks like formatting support for 128-bit integers is less common in libc.

    Note: <stdint.h> defines __int128_t and __uint128_t on versions before gcc4.6. See also Is there a 128 bit integer in gcc? for a table of gcc/clang/ICC versions.

    How to know if __uint128_t is defined for detecting __int128