Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/multiprecision/cpp_int/comparison.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
70 BOOST_MP_FORCEINLINE typename enable_if_c< | 70 BOOST_MP_FORCEINLINE typename enable_if_c< |
71 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value, | 71 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value, |
72 bool | 72 bool |
73 >::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT | 73 >::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT |
74 { | 74 { |
75 BOOST_MP_USING_ABS | |
76 return (a.sign() == (b < 0)) | 75 return (a.sign() == (b < 0)) |
77 && (a.size() == 1) | 76 && (a.size() == 1) |
78 && (*a.limbs() == static_cast<limb_type>(abs(b))); | 77 && (*a.limbs() == boost::multiprecision::detail::unsigned_abs(b)); |
79 } | 78 } |
80 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator> | 79 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator> |
81 BOOST_MP_FORCEINLINE typename enable_if_c< | 80 BOOST_MP_FORCEINLINE typename enable_if_c< |
82 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value, | 81 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value, |
83 bool | 82 bool |
111 inline typename enable_if_c< | 110 inline typename enable_if_c< |
112 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value, | 111 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator> >::value, |
113 bool | 112 bool |
114 >::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT | 113 >::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT |
115 { | 114 { |
116 BOOST_MP_USING_ABS | |
117 if((b == 0) || (a.sign() != (b < 0))) | 115 if((b == 0) || (a.sign() != (b < 0))) |
118 return a.sign(); | 116 return a.sign(); |
119 if(a.sign()) | 117 if(a.sign()) |
120 { | 118 { |
121 if(a.size() > 1) | 119 if(a.size() > 1) |
122 return true; | 120 return true; |
123 return *a.limbs() > static_cast<limb_type>(abs(b)); | 121 return *a.limbs() > boost::multiprecision::detail::unsigned_abs(b); |
124 } | 122 } |
125 else | 123 else |
126 { | 124 { |
127 if(a.size() > 1) | 125 if(a.size() > 1) |
128 return false; | 126 return false; |
129 return *a.limbs() < static_cast<limb_type>(b); | 127 return *a.limbs() < boost::multiprecision::detail::unsigned_abs(b); |
130 } | 128 } |
131 } | 129 } |
132 | 130 |
133 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator> | 131 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator> |
134 BOOST_MP_FORCEINLINE typename enable_if_c< | 132 BOOST_MP_FORCEINLINE typename enable_if_c< |
165 inline typename enable_if_c< | 163 inline typename enable_if_c< |
166 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value, | 164 !is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, Allocator> >::value, |
167 bool | 165 bool |
168 >::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT | 166 >::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT |
169 { | 167 { |
170 BOOST_MP_USING_ABS | |
171 if(b == 0) | 168 if(b == 0) |
172 return !a.sign() && ((a.size() > 1) || *a.limbs()); | 169 return !a.sign() && ((a.size() > 1) || *a.limbs()); |
173 if(a.sign() != (b < 0)) | 170 if(a.sign() != (b < 0)) |
174 return !a.sign(); | 171 return !a.sign(); |
175 if(a.sign()) | 172 if(a.sign()) |
176 { | 173 { |
177 if(a.size() > 1) | 174 if(a.size() > 1) |
178 return false; | 175 return false; |
179 return *a.limbs() < static_cast<limb_type>(abs(b)); | 176 return *a.limbs() < boost::multiprecision::detail::unsigned_abs(b); |
180 } | 177 } |
181 else | 178 else |
182 { | 179 { |
183 if(a.size() > 1) | 180 if(a.size() > 1) |
184 return true; | 181 return true; |
185 return *a.limbs() > static_cast<limb_type>(b); | 182 return *a.limbs() > boost::multiprecision::detail::unsigned_abs(b); |
186 } | 183 } |
187 } | 184 } |
188 | 185 |
189 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator> | 186 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator> |
190 BOOST_MP_FORCEINLINE typename enable_if_c< | 187 BOOST_MP_FORCEINLINE typename enable_if_c< |
235 BOOST_MP_FORCEINLINE typename enable_if_c< | 232 BOOST_MP_FORCEINLINE typename enable_if_c< |
236 is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value, | 233 is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value, |
237 bool | 234 bool |
238 >::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT | 235 >::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT |
239 { | 236 { |
240 BOOST_MP_USING_ABS | 237 return (a.sign() == (b < 0)) && (*a.limbs() == boost::multiprecision::detail::unsigned_abs(b)); |
241 typedef typename make_unsigned<S>::type ui_type; | |
242 return (a.sign() == (b < 0)) && (*a.limbs() == static_cast<ui_type>(abs(b))); | |
243 } | 238 } |
244 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U> | 239 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U> |
245 BOOST_MP_FORCEINLINE typename enable_if_c< | 240 BOOST_MP_FORCEINLINE typename enable_if_c< |
246 is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value, | 241 is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value, |
247 bool | 242 bool |
299 BOOST_MP_FORCEINLINE typename enable_if_c< | 294 BOOST_MP_FORCEINLINE typename enable_if_c< |
300 is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value, | 295 is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value, |
301 bool | 296 bool |
302 >::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT | 297 >::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT |
303 { | 298 { |
304 BOOST_MP_USING_ABS | |
305 typedef typename make_unsigned<S>::type ui_type; | |
306 if(a.sign() != (b < 0)) | 299 if(a.sign() != (b < 0)) |
307 return a.sign(); | 300 return a.sign(); |
308 return a.sign() ? (*a.limbs() > static_cast<ui_type>(abs(b))) : (*a.limbs() < static_cast<ui_type>(abs(b))); | 301 return a.sign() ? (*a.limbs() > boost::multiprecision::detail::unsigned_abs(b)) : (*a.limbs() < boost::multiprecision::detail::unsigned_abs(b)); |
309 } | 302 } |
310 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U> | 303 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U> |
311 BOOST_MP_FORCEINLINE typename enable_if_c< | 304 BOOST_MP_FORCEINLINE typename enable_if_c< |
312 is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value, | 305 is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value, |
313 bool | 306 bool |
365 BOOST_MP_FORCEINLINE typename enable_if_c< | 358 BOOST_MP_FORCEINLINE typename enable_if_c< |
366 is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value, | 359 is_signed<S>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void> >::value, |
367 bool | 360 bool |
368 >::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT | 361 >::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT |
369 { | 362 { |
370 BOOST_MP_USING_ABS | |
371 typedef typename make_unsigned<S>::type ui_type; | |
372 if(a.sign() != (b < 0)) | 363 if(a.sign() != (b < 0)) |
373 return !a.sign(); | 364 return !a.sign(); |
374 return a.sign() ? (*a.limbs() < static_cast<ui_type>(abs(b))) : (*a.limbs() > static_cast<ui_type>(abs(b))); | 365 return a.sign() ? (*a.limbs() < boost::multiprecision::detail::unsigned_abs(b)) : (*a.limbs() > boost::multiprecision::detail::unsigned_abs(b)); |
375 } | 366 } |
376 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U> | 367 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U> |
377 BOOST_MP_FORCEINLINE typename enable_if_c< | 368 BOOST_MP_FORCEINLINE typename enable_if_c< |
378 is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value, | 369 is_unsigned<U>::value && is_trivial_cpp_int<cpp_int_backend<MinBits, MaxBits, unsigned_magnitude, Checked, void> >::value, |
379 bool | 370 bool |