1 // (C) Copyright John Maddock 2012.
2 // (C) Copyright Dynatrace 2017.
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/config for most recent version.
9 // MACRO: BOOST_HAS_INT128
11 // DESCRIPTION: The platform supports __int128.
17 namespace boost_has_int128{
20 __extension__ typedef __int128 my_int128_t;
21 __extension__ typedef unsigned __int128 my_uint128_t;
23 typedef __int128 my_int128_t;
24 typedef unsigned __int128 my_uint128_t;
27 my_uint128_t volatile g_ui128 = 0;
28 unsigned long volatile g_ul = 0;
32 my_int128_t si128 = 0;
35 // Some compilers have seriously broken __int128 implementations, so we need to do a little more than simply check if we can declare variables with __int128...
36 // #1: check __int128 size
37 if (sizeof(my_uint128_t) < (128 / CHAR_BIT))
39 fputs("Type too small.", stderr);
43 // #2: check result of computation with __int128
52 fputs("Unexpected overflow.", stderr);
59 g_ul = static_cast<unsigned long>((g_ui128 >> 92) & 0xFFFFFFFFUL);
63 fputs("Incorrect computation result.", stderr);
67 my_uint128_t ii(2), jj(1), kk;