File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44endif ()
55project (Cppcheck VERSION 2.16.99 LANGUAGES CXX )
66
7+ include (cmake/options.cmake )
8+
79include (cmake/cxx11.cmake )
810use_cxx11 ()
911set (CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -14,7 +16,6 @@ include(GNUInstallDirs)
1416
1517include (cmake/compilerCheck.cmake )
1618include (cmake/versions.cmake )
17- include (cmake/options.cmake )
1819include (cmake/findDependencies.cmake )
1920include (cmake/compileroptions.cmake )
2021include (cmake/compilerDefinitions.cmake )
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ endif()
3535
3636if (Boost_FOUND)
3737 add_definitions (-DHAVE_BOOST )
38+ if (USE_BOOST_INT128)
39+ add_definitions (-DHAVE_BOOST_INT128 )
40+ endif ()
3841endif ()
3942
4043if (ENABLE_CHECK_INTERNAL)
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ macro(use_cxx11)
33 if (MSVC AND USE_QT6)
44 # CMAKE_CXX_STANDARD 17 was added in CMake 3.8
55 set (CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use" )
6+ elseif (USE_BOOST AND USE_BOOST_INT128)
7+ # Boost.Math requires C++14
8+ set (CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to use" )
69 else ()
710 set (CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use" )
811 endif ()
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ endif()
6767option (CPPCHK_GLIBCXX_DEBUG "Usage of STL debug checks in Debug build" ON )
6868option (DISALLOW_THREAD_EXECUTOR "Disallow usage of ThreadExecutor for -j" OFF )
6969option (USE_BOOST "Usage of Boost" OFF )
70+ option (USE_BOOST_INT128 "Usage of Boost.Multiprecision 128-bit integer for Mathlib" OFF )
7071option (USE_LIBCXX "Use libc++ instead of libstdc++" OFF )
7172
7273if (DISALLOW_THREAD_EXECUTOR AND WIN32 )
Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ if(USE_BOOST)
9595 message (STATUS "Boost_FOUND = ${Boost_FOUND} " )
9696 message (STATUS "Boost_VERSION_STRING = ${Boost_VERSION_STRING} " )
9797 message (STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS} " )
98+ message (STATUS "USE_BOOST_INT128 = ${USE_BOOST_INT128} " )
99+ message (STATUS )
98100endif ()
99101message (STATUS "USE_LIBCXX = ${USE_LIBCXX} " )
100102message (STATUS )
Original file line number Diff line number Diff line change 2626#include < cstdint>
2727#include < string>
2828
29+ #if defined(HAVE_BOOST) && defined(HAVE_BOOST_INT128)
30+ #include < boost/multiprecision/cpp_int.hpp>
31+ #endif
32+
2933// / @addtogroup Core
3034// / @{
3135
@@ -35,6 +39,14 @@ class CPPCHECKLIB MathLib {
3539 friend class TestMathLib ;
3640
3741public:
42+ #if defined(HAVE_BOOST) && defined(HAVE_BOOST_INT128)
43+ using bigint = boost::multiprecision::int128_t ;
44+ using biguint = boost::multiprecision::uint128_t ;
45+ #else
46+ using bigint = long long ;
47+ using biguint = unsigned long long ;
48+ #endif
49+
3850 /* * @brief value class */
3951 class value {
4052 private:
@@ -66,8 +78,6 @@ class CPPCHECKLIB MathLib {
6678 value shiftRight (const value &v) const ;
6779 };
6880
69- using bigint = long long ;
70- using biguint = unsigned long long ;
7181 static const int bigint_bits;
7282
7383 /* * @brief for conversion of numeric literals - for atoi-like conversions please use strToInt() */
You can’t perform that action at this time.
0 commit comments