Is there a 128 bit integer in gcc?

MetallicPriest picture MetallicPriest · Apr 18, 2013 · Viewed 71.8k times · Source

I want a 128 bit integer because I want to store results of multiplication of two 64 bit numbers. Is there any such thing in gcc 4.4 and above?

Answer

slezica picture slezica · Apr 18, 2013

Ah, big integers are not C's forte.

GCC does have an unsigned __int128/__int128 type, starting from version 4.something (not sure here). I do seem to recall, however, that there was a __int128_t def before that.

These are only available on 64-bit targets.

(Editor's note: this answer used to claim that gcc defined uint128_t and int128_t. None of the versions I tested on the Godbolt compiler explorer define those types without leading __, from gcc4.1 to 8.2 , or clang or ICC.)