- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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-and-in-the-intel-c-compiler

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

See bigint.h link on above page.

Jim Dempsey

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

**1**. Maximum signed 64-bit integer number I could process is

**9223372036854775807**( = 2^63 - 1 = 9223372036854775808 - 1 ).

**2**. Even if I change declarations of variables to unsigned 64-bit integer nothing could be done after 2^64 - 1 ( 18446744073709551615 = 18446744073709551616 - 1 ) limit is reached.

**3**. Because

**18446744073709551615**U +

**1**U =

**0**( check it by yourself... ).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

**SSE2**Instruction Set Architecture

**__m128i**should look like:

**[ emmintrin.h ]**... typedef union __declspec(intrin_type) _CRT_ALIGN(16)

**__m128i**{ __int8 m128i_i8[16]; __int16 m128i_i16[8]; __int32 m128i_i32[4]; __int64 m128i_i64[2];

**__int128 m128i_i128[1]**; unsigned __int8 m128i_u8[16]; unsigned __int16 m128i_u16[8]; unsigned __int32 m128i_u32[4]; unsigned __int64 m128i_u64[2];

**unsigned __int128 m128i_u128[1]**; }

**__m128i**; ...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page