Does gcc support 128-bit int on amd64?

Yichao Zhou picture Yichao Zhou · Jul 25, 2010 · Viewed 12.7k times · Source

Does gcc support 128-bit int on amd64?

How to define it?

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

Answer

rkhayrov picture rkhayrov · Jul 25, 2010

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