• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 ///////////////////////////////////////////////////////////////
2 //  Copyright 2012 John Maddock. Distributed under the Boost
3 //  Software License, Version 1.0. (See accompanying file
4 //  LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
5 
6 #define TEST_CHECKED_INT
7 
8 #include <boost/multiprecision/cpp_int.hpp>
9 
10 #include "test_arithmetic.hpp"
11 
12 template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, class Allocator, boost::multiprecision::expression_template_option ExpressionTemplates>
13 struct is_twos_complement_integer<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, boost::multiprecision::checked, Allocator>, ExpressionTemplates> > : public boost::mpl::false_
14 {};
15 
16 template <>
17 struct related_type<boost::multiprecision::cpp_int>
18 {
19    typedef boost::multiprecision::int256_t type;
20 };
21 template <unsigned MinBits, unsigned MaxBits, boost::multiprecision::cpp_integer_type SignType, boost::multiprecision::cpp_int_check_type Checked, class Allocator, boost::multiprecision::expression_template_option ET>
22 struct related_type<boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>, ET> >
23 {
24    typedef boost::multiprecision::number<boost::multiprecision::cpp_int_backend<MinBits / 2, MaxBits / 2, SignType, Checked, Allocator>, ET> type;
25 };
26 
27 template <>
28 struct is_checked_cpp_int<boost::multiprecision::checked_cpp_int> : public boost::mpl::true_
29 {};
30 
main()31 int main()
32 {
33    test<boost::multiprecision::checked_cpp_int>();
34    return boost::report_errors();
35 }
36