6 //typedef unsigned __int128 uint128_t __attribute__((mode(TI)));
7 typedef unsigned int uint128_t
__attribute__((mode(TI
)));
12 typedef __float128 float128
__attribute__((mode(TF
)));
16 #define FORCE_INLINE __forceinline
17 #else // defined(_MSC_VER)
18 #define FORCE_INLINE static inline __attribute__((always_inline))
19 #endif // !defined(_MSC_VER)
25 http://stackoverflow.com/questions/1188939/representing-128-bit-numbers-in-c
26 typedef unsigned int uint128_t __attribute__((mode(TI)));
28 http://gcc.gnu.org/gcc-4.4/changes.html
30 Support for __float128 (TFmode) IEEE quad type and corresponding TCmode IEEE complex quad type is available via the soft-fp library on IA-32/IA64 targets. This includes basic arithmetic operations (addition, subtraction, negation, multiplication and division) on __float128 real and TCmode complex values, the full set of IEEE comparisons between __float128 values, conversions to and from float, double and long double floating point types, as well as conversions to and from signed or unsigned integer, signed or unsigned long integer and signed or unsigned quad (TImode, IA64 only) integer types. Additionally, all operations generate the full set of IEEE exceptions and support the full set of IEEE rounding modes.
32 asm ("dmultu\t%1,%2" : "=h" (result) : "r" (x), "r" (y));
33 You can now achieve the same effect using 128-bit types:
34 typedef unsigned int uint128_t __attribute__((mode(TI)));
35 result = ((uint128_t) x * y) >> 64;
37 http://gcc.gnu.org/gcc-4.3/changes.html
39 Support for __float128 (TFmode) IEEE quad type and corresponding TCmode IEEE complex quad type is available via the soft-fp library on x86_64 targets. This includes basic arithmetic operations (addition, subtraction, negation, multiplication and division) on __float128 real and TCmode complex values, the full set of IEEE comparisons between __float128 values, conversions to and from float, double and long double floating point types, as well as conversions to and from signed or unsigned integer, signed or unsigned long integer and signed or unsigned quad (TImode) integer types. Additionally, all operations generate the full set of IEEE exceptions and support the full set of IEEE rounding modes.
41 http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00354.html
42 [patch]: Add support of new __int128 type for targets having 128-bit integer scalar support
43 http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00354/int128doc.diff
44 + static const char *const suffixes[] = { "", "U", "L", "UL", "LL", "ULL", "I128", "UI128" };
46 http://en.wikipedia.org/wiki/Floating_point
47 Type Sign Exponent Significand Total bits Exponent bias Bits precision
48 Single 1 8 23 32 127 24
49 Double 1 11 52 64 1023 53
50 Quad 1 15 112 128 16383 113