128-bit Integer Arithmetic

128-bit Integer Arithmetic

As a non-standard extension, both GCC and Clang provide __uint128_t and __int128_t for emulated 128-bit integer arithmetic in C. The basic arithmetic operations +, -, *, /, %, as well as bitwise operations work on these datatypes in the same fashion as normal integers, and performance is quite good. I'm wondering (1) if there are any equivalent datatypes supported by ICC and (2) if there are plans to include anything similar in ICC.

I also posted this question on Stack Overflow: http://stackoverflow.com/questions/16365840/128-bit-integers-supporting-...

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.


See bigint.h link on above page.

Jim Dempsey


Yes, it's true that there are libraries to do high-precision arithmetic and some of these are efficient for "smaller" widths like 128-bits. That class you linked to might be a candidate if I were using C++ instead of C. Does it overload the built-in operators like +, -, *, /, and %? I get the impression that this int128 class does just that (again, C++ only): http://mx-3.cz/tringi/www/int128

Unfortunately C doesn't have overloading so no such library exists for C.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya