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-...

3 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

http://homepages.ihug.co.nz/~aurora76/Malc/Useful_Classes.htm

See bigint.h link on above page.

Jim Dempsey

www.quickthreadprogramming.com

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.

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi