0

My compiler is GNU GCC. What I have to do to work on __int128_t? Do I have to include some library or change compiler?

Tom
  • 129
  • 7
  • GCC supports `__int128` on a 64-bit architecture. Are you on a 64-bit architecture? – Eljay Mar 14 '22 at 15:26
  • @Eljay I have 64-bit Windows. – Tom Mar 14 '22 at 15:28
  • Have you tried GCC's `__int128`? – Eljay Mar 14 '22 at 15:35
  • @Eljay yes, it also doesn't work. – Tom Mar 14 '22 at 15:37
  • 1
    I'd check to make sure you are running a GCC that targets 64-bit architecture. You may be producing 32-bit executables. – Eljay Mar 14 '22 at 16:22
  • @Eljay how to check it? It is about right version of GCC? – Tom Mar 15 '22 at 00:14
  • `std::cout << (sizeof(void*) * 8) << "\n";` should be a good indicator. – Eljay Mar 15 '22 at 13:11
  • Alternatively, `touch /tmp/empty.cpp` and then `g++ -E -dM /tmp/empty.cpp | grep -i -e amd -e x86` – Eljay Mar 15 '22 at 13:17
  • I have the newest gcc: https://jmeubank.github.io/tdm-gcc/. But __int128 still doesn't work. – Tom Mar 23 '22 at 16:25
  • @Eljay what it means to be on 64-bit architecture? – Tom Mar 23 '22 at 16:29
  • `touch empty.cpp` then `g++ -E -dM empty.cpp` and look for `#define _LP64 1` or something like that, or other defines with the word `WIDTH` in them. – Eljay Mar 23 '22 at 19:51
  • `g++ -v` or `g++ -dumpmachine` should also be able to tell you which architecture you're on. More info at: https://stackoverflow.com/questions/11727855/obtaining-current-gcc-architecture – Eljay Mar 23 '22 at 19:54
  • @Eljay I have x86_64-linux-gnu. – Tom Mar 24 '22 at 10:07
  • As per the [documentation](https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html), I can only surmise that your *particular* 64-bit platform does not have an integer mode wide enough to hold 128 bits, which is why there is no `__int128`. – Eljay Mar 24 '22 at 13:12

0 Answers0