Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

__uint128_t on mingw gcc

I'm trying to compile a c program under mingw gcc. This program is using an __uint128_t integer. When I try to compile it under the standard ubuntu gcc on the same 64-bit machine, it perfectly works. But then, when I try to compile it for windows under mingw, it simply doesn't even recognize the __uint128_t keyword. What does this mean? There aren't 128 bit integers under mingw? If not, is there any programming language for windows which has native (and FAST) 128 bit integers?

like image 351
Matteo Monti Avatar asked Aug 24 '11 11:08

Matteo Monti


2 Answers

You need

  • a relatively recent version of gcc
  • a version compiled with native 64 bit integer support

__int128_t is then emulated by using pairs of int64_t in the same way as 64bit integers are emulated with 32bit if they are not available on 32bit compiles

like image 72
Jens Gustedt Avatar answered Nov 08 '22 09:11

Jens Gustedt


I was able to get the same problem using Code::Blocks and the default mingw install (which is IA32 btw), however, when I installed TDM-MinGW64, it compiled fine (after adding the x64 compiler to C::B). So make sure your mingw build is targeting x64 (with -m64) and it is an x64 build of mingw, as __uint128_t is an optional x64 ABI extension.

whatever windows IDE you are using won't pick up __int128_t as a keyword though, as its a special GCC extension (as mentioned).

like image 40
Necrolis Avatar answered Nov 08 '22 07:11

Necrolis