comparison DEPENDENCIES/generic/include/boost/multiprecision/tommath.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
56 m_data = o.m_data; 56 m_data = o.m_data;
57 o.m_data.dp = 0; 57 o.m_data.dp = 0;
58 } 58 }
59 tommath_int& operator = (tommath_int&& o) 59 tommath_int& operator = (tommath_int&& o)
60 { 60 {
61 mp_exch(&m_data, &o.data()); 61 mp_exch(&m_data, &o.m_data);
62 return *this; 62 return *this;
63 } 63 }
64 #endif 64 #endif
65 tommath_int& operator = (const tommath_int& o) 65 tommath_int& operator = (const tommath_int& o)
66 { 66 {
91 mp_clear(&t); 91 mp_clear(&t);
92 return *this; 92 return *this;
93 } 93 }
94 tommath_int& operator = (long long i) 94 tommath_int& operator = (long long i)
95 { 95 {
96 BOOST_MP_USING_ABS
97 if(m_data.dp == 0) 96 if(m_data.dp == 0)
98 detail::check_tommath_result(mp_init(&m_data)); 97 detail::check_tommath_result(mp_init(&m_data));
99 bool neg = i < 0; 98 bool neg = i < 0;
100 *this = static_cast<unsigned long long>(abs(i)); 99 *this = boost::multiprecision::detail::unsigned_abs(i);
101 if(neg) 100 if(neg)
102 detail::check_tommath_result(mp_neg(&m_data, &m_data)); 101 detail::check_tommath_result(mp_neg(&m_data, &m_data));
103 return *this; 102 return *this;
104 } 103 }
105 // 104 //
313 std::string result = a.get(); 312 std::string result = a.get();
314 if((base != 10) && (f & std::ios_base::showbase)) 313 if((base != 10) && (f & std::ios_base::showbase))
315 { 314 {
316 int pos = result[0] == '-' ? 1 : 0; 315 int pos = result[0] == '-' ? 1 : 0;
317 const char* pp = base == 8 ? "0" : "0x"; 316 const char* pp = base == 8 ? "0" : "0x";
318 result.insert(pos, pp); 317 result.insert(static_cast<std::string::size_type>(pos), pp);
319 } 318 }
320 if((f & std::ios_base::showpos) && (result[0] != '-')) 319 if((f & std::ios_base::showpos) && (result[0] != '-'))
321 result.insert(0, 1, '+'); 320 result.insert(static_cast<std::string::size_type>(0), 1, '+');
322 return result; 321 return result;
323 } 322 }
324 ~tommath_int() 323 ~tommath_int()
325 { 324 {
326 if(m_data.dp) 325 if(m_data.dp)