Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:13

0001 ///////////////////////////////////////////////////////////////
0002 //  Copyright 2012 John Maddock. Distributed under the Boost
0003 //  Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
0005 //
0006 // Comparison operators for cpp_int_backend:
0007 //
0008 #ifndef BOOST_MP_CPP_INT_COMPARISON_HPP
0009 #define BOOST_MP_CPP_INT_COMPARISON_HPP
0010 
0011 #include <boost/multiprecision/detail/constexpr.hpp>
0012 
0013 namespace boost { namespace multiprecision { namespace backends {
0014 
0015 #ifdef BOOST_MSVC
0016 #pragma warning(push)
0017 #pragma warning(disable : 4018 4389 4996)
0018 #endif
0019 
0020 //
0021 // Start with non-trivial cpp_int's:
0022 //
0023 template <std::size_t MinBits, std::size_t MaxBits, cpp_integer_type SignType, cpp_int_check_type Checked, class Allocator>
0024 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0025     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator> >::value,
0026     bool>::type
0027 eval_eq(const cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& a, const cpp_int_backend<MinBits, MaxBits, SignType, Checked, Allocator>& b) noexcept
0028 {
0029    return (a.sign() == b.sign()) && (a.size() == b.size()) && std_constexpr::equal(a.limbs(), a.limbs() + a.size(), b.limbs());
0030 }
0031 template <std::size_t MinBits1, std::size_t MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, std::size_t MinBits2, std::size_t MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>
0032 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0033     !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && !is_trivial_cpp_int<cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2> >::value,
0034     bool>::type
0035 eval_eq(const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& a, const cpp_int_backend<MinBits2, MaxBits2, SignType2, Checked2, Allocator2>& b) noexcept
0036 {
0037    return (a.sign() == b.sign()) && (a.size() == b.size()) && std_constexpr::equal(a.limbs(), a.limbs() + a.size(), b.limbs());
0038 }
0039 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0040 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0041     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
0042     bool>::type
0043 eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, limb_type b) noexcept
0044 {
0045    return (a.sign() == false) && (a.size() == 1) && (*a.limbs() == b);
0046 }
0047 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0048 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0049     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
0050     bool>::type
0051 eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) noexcept
0052 {
0053    return (a.sign() == (b < 0)) && (a.size() == 1) && (*a.limbs() == boost::multiprecision::detail::unsigned_abs(b));
0054 }
0055 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0056 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0057     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0058     bool>::type
0059 eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, limb_type b) noexcept
0060 {
0061    return (a.size() == 1) && (*a.limbs() == b);
0062 }
0063 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0064 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0065     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0066     bool>::type
0067 eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, signed_limb_type b) noexcept
0068 {
0069    return (b < 0) ? eval_eq(a, cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>(b)) : eval_eq(a, static_cast<limb_type>(b)); // Use bit pattern of b for comparison
0070 }
0071 
0072 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0073 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0074     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
0075     bool>::type
0076 eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, limb_type b) noexcept
0077 {
0078    if (a.sign())
0079       return true;
0080    if (a.size() > 1)
0081       return false;
0082    return *a.limbs() < b;
0083 }
0084 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0085 inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0086     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
0087     bool>::type
0088 eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) noexcept
0089 {
0090    if ((b == 0) || (a.sign() != (b < 0)))
0091       return a.sign();
0092    if (a.sign())
0093    {
0094       if (a.size() > 1)
0095          return true;
0096       return *a.limbs() > boost::multiprecision::detail::unsigned_abs(b);
0097    }
0098    else
0099    {
0100       if (a.size() > 1)
0101          return false;
0102       return *a.limbs() < boost::multiprecision::detail::unsigned_abs(b);
0103    }
0104 }
0105 
0106 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0107 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0108     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0109     bool>::type
0110 eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, limb_type b) noexcept
0111 {
0112    if (a.size() > 1)
0113       return false;
0114    return *a.limbs() < b;
0115 }
0116 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0117 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0118     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0119     bool>::type
0120 eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, signed_limb_type b) noexcept
0121 {
0122    return (b < 0) ? a.compare(b) < 0 : eval_lt(a, static_cast<limb_type>(b)); // Use bit pattern of b for comparison
0123 }
0124 
0125 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0126 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0127     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value,
0128     bool>::type
0129 eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, limb_type b) noexcept
0130 {
0131    if (a.sign())
0132       return false;
0133    if (a.size() > 1)
0134       return true;
0135    return *a.limbs() > b;
0136 }
0137 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0138 inline BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0139     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0140     bool>::type
0141 eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) noexcept
0142 {
0143    if (b == 0)
0144       return !a.sign() && ((a.size() > 1) || *a.limbs());
0145    if (a.sign() != (b < 0))
0146       return !a.sign();
0147    if (a.sign())
0148    {
0149       if (a.size() > 1)
0150          return false;
0151       return *a.limbs() < boost::multiprecision::detail::unsigned_abs(b);
0152    }
0153    else
0154    {
0155       if (a.size() > 1)
0156          return true;
0157       return *a.limbs() > boost::multiprecision::detail::unsigned_abs(b);
0158    }
0159 }
0160 
0161 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0162 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0163     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0164     bool>::type
0165 eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, limb_type b) noexcept
0166 {
0167    if (a.size() > 1)
0168       return true;
0169    return *a.limbs() > b;
0170 }
0171 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class Allocator>
0172 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0173     !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value,
0174     bool>::type
0175 eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator>& a, signed_limb_type b) noexcept
0176 {
0177    return (b < 0) ? a.compare(b) > 0 : eval_gt(a, static_cast<limb_type>(b)); // Use bit pattern of b for comparison.
0178 }
0179 //
0180 // And again for trivial cpp_ints:
0181 //
0182 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked>
0183 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0184     is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0185     bool>::value
0186 eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& b) noexcept
0187 {
0188    return (a.sign() == b.sign()) && (*a.limbs() == *b.limbs());
0189 }
0190 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked>
0191 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0192     is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0193     bool>::value
0194 eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) noexcept
0195 {
0196    return *a.limbs() == *b.limbs();
0197 }
0198 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class U>
0199 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0200     boost::multiprecision::detail::is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0201     bool>::type
0202 eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, U b) noexcept
0203 {
0204    return !a.sign() && (*a.limbs() == b);
0205 }
0206 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class S>
0207 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0208     boost::multiprecision::detail::is_signed<S>::value && boost::multiprecision::detail::is_integral<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0209     bool>::type
0210 eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) noexcept
0211 {
0212    return (a.sign() == (b < 0)) && (*a.limbs() == boost::multiprecision::detail::unsigned_abs(b));
0213 }
0214 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class U>
0215 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0216     boost::multiprecision::detail::is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0217     bool>::type
0218 eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, U b) noexcept
0219 {
0220    return *a.limbs() == b;
0221 }
0222 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class S>
0223 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0224     boost::multiprecision::detail::is_signed<S>::value && boost::multiprecision::detail::is_integral<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0225     bool>::type
0226 eval_eq(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, S b) noexcept
0227 {
0228    using ui_type = typename boost::multiprecision::detail::make_unsigned<S>::type;
0229    if (b < 0)
0230    {
0231       cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> t(b);
0232       return *a.limbs() == *t.limbs();
0233    }
0234    else
0235    {
0236       return *a.limbs() == static_cast<ui_type>(b);
0237    }
0238 }
0239 
0240 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked>
0241 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0242     is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0243     bool>::type
0244 eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) noexcept
0245 {
0246    if (a.sign() != b.sign())
0247       return a.sign();
0248    return a.sign() ? *a.limbs() > *b.limbs() : *a.limbs() < *b.limbs();
0249 }
0250 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked>
0251 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0252     is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0253     bool>::type
0254 eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) noexcept
0255 {
0256    return *a.limbs() < *b.limbs();
0257 }
0258 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class U>
0259 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0260     boost::multiprecision::detail::is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0261     bool>::type
0262 eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, U b) noexcept
0263 {
0264    if (a.sign())
0265       return true;
0266    return *a.limbs() < b;
0267 }
0268 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class S>
0269 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0270     boost::multiprecision::detail::is_signed<S>::value && boost::multiprecision::detail::is_integral<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0271     bool>::type
0272 eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) noexcept
0273 {
0274    if (a.sign() != (b < 0))
0275       return a.sign();
0276    return a.sign() ? (*a.limbs() > boost::multiprecision::detail::unsigned_abs(b)) : (*a.limbs() < boost::multiprecision::detail::unsigned_abs(b));
0277 }
0278 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class U>
0279 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0280     boost::multiprecision::detail::is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0281     bool>::type
0282 eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, U b) noexcept
0283 {
0284    return *a.limbs() < b;
0285 }
0286 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class S>
0287 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0288     boost::multiprecision::detail::is_signed<S>::value && boost::multiprecision::detail::is_integral<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0289     bool>::type
0290 eval_lt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, S b) noexcept
0291 {
0292    using ui_type = typename boost::multiprecision::detail::make_unsigned<S>::type;
0293    if (b < 0)
0294    {
0295       cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> t(b);
0296       return *a.limbs() < *t.limbs();
0297    }
0298    else
0299    {
0300       return *a.limbs() < static_cast<ui_type>(b);
0301    }
0302 }
0303 
0304 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked>
0305 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0306     is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0307     bool>::type
0308 eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& b) noexcept
0309 {
0310    if (a.sign() != b.sign())
0311       return !a.sign();
0312    return a.sign() ? *a.limbs() < *b.limbs() : *a.limbs() > *b.limbs();
0313 }
0314 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked>
0315 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0316     is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0317     bool>::type
0318 eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& b) noexcept
0319 {
0320    return *a.limbs() > *b.limbs();
0321 }
0322 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class U>
0323 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0324     boost::multiprecision::detail::is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0325     bool>::type
0326 eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, U b) noexcept
0327 {
0328    if (a.sign())
0329       return false;
0330    return *a.limbs() > b;
0331 }
0332 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class S>
0333 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0334     boost::multiprecision::detail::is_signed<S>::value && boost::multiprecision::detail::is_integral<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value,
0335     bool>::type
0336 eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) noexcept
0337 {
0338    if (a.sign() != (b < 0))
0339       return !a.sign();
0340    return a.sign() ? (*a.limbs() < boost::multiprecision::detail::unsigned_abs(b)) : (*a.limbs() > boost::multiprecision::detail::unsigned_abs(b));
0341 }
0342 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class U>
0343 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0344     boost::multiprecision::detail::is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0345     bool>::type
0346 eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, U b) noexcept
0347 {
0348    return *a.limbs() > b;
0349 }
0350 template <std::size_t MinBits, std::size_t MaxBits, cpp_int_check_type Checked, class S>
0351 BOOST_MP_FORCEINLINE BOOST_MP_CXX14_CONSTEXPR typename std::enable_if<
0352     boost::multiprecision::detail::is_signed<S>::value && boost::multiprecision::detail::is_integral<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value,
0353     bool>::type
0354 eval_gt(const cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void>& a, S b) noexcept
0355 {
0356    using ui_type = typename boost::multiprecision::detail::make_unsigned<S>::type;
0357    if (b < 0)
0358    {
0359       cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> t(b);
0360       return *a.limbs() > *t.limbs();
0361    }
0362    else
0363    {
0364       return *a.limbs() > static_cast<ui_type>(b);
0365    }
0366 }
0367 
0368 #ifdef BOOST_MSVC
0369 #pragma warning(pop)
0370 #endif
0371 
0372 }}} // namespace boost::multiprecision::backends
0373 
0374 #endif