Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81423 - in trunk/boost/multiprecision: . cpp_int
From: john_at_[hidden]
Date: 2012-11-19 08:30:34


Author: johnmaddock
Date: 2012-11-19 08:30:33 EST (Mon, 19 Nov 2012)
New Revision: 81423
URL: http://svn.boost.org/trac/boost/changeset/81423

Log:
Misc minor fixes for VC9.
Text files modified:
   trunk/boost/multiprecision/cpp_dec_float.hpp | 9 +++++++++
   trunk/boost/multiprecision/cpp_int/comparison.hpp | 18 ++++++++++++------
   trunk/boost/multiprecision/cpp_int/misc.hpp | 3 ++-
   3 files changed, 23 insertions(+), 7 deletions(-)

Modified: trunk/boost/multiprecision/cpp_dec_float.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_dec_float.hpp (original)
+++ trunk/boost/multiprecision/cpp_dec_float.hpp 2012-11-19 08:30:33 EST (Mon, 19 Nov 2012)
@@ -50,6 +50,15 @@
 {
    dynamic_array()
       : std::vector<T, typename rebind<T, Allocator>::type>(static_cast<typename std::vector<T, typename rebind<T, Allocator>::type>::size_type>(S), static_cast<T>(0)) {}
+
+ T* data()
+ {
+ return &*this->begin();
+ }
+ const T* data()const
+ {
+ return &*this->begin();
+ }
 };
 
 }

Modified: trunk/boost/multiprecision/cpp_int/comparison.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/comparison.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/comparison.hpp 2012-11-19 08:30:33 EST (Mon, 19 Nov 2012)
@@ -59,9 +59,10 @@
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
 {
+ BOOST_MP_USING_ABS
    return (a.sign() == (b < 0))
       && (a.size() == 1)
- && (*a.limbs() == static_cast<limb_type>(std::abs(b)));
+ && (*a.limbs() == static_cast<limb_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class Allocator>
 BOOST_FORCEINLINE typename enable_if_c<
@@ -99,13 +100,14 @@
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
 {
+ BOOST_MP_USING_ABS
    if((b == 0) || (a.sign() != (b < 0)))
       return a.sign();
    if(a.sign())
    {
       if(a.size() > 1)
          return true;
- return *a.limbs() > static_cast<limb_type>(std::abs(b));
+ return *a.limbs() > static_cast<limb_type>(abs(b));
    }
    else
    {
@@ -152,6 +154,7 @@
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, Allocator>& a, signed_limb_type b) BOOST_NOEXCEPT
 {
+ BOOST_MP_USING_ABS
    if(b == 0)
       return !a.sign() && ((a.size() > 1) || *a.limbs());
    if(a.sign() != (b < 0))
@@ -160,7 +163,7 @@
    {
       if(a.size() > 1)
          return false;
- return *a.limbs() < static_cast<limb_type>(std::abs(b));
+ return *a.limbs() < static_cast<limb_type>(abs(b));
    }
    else
    {
@@ -221,8 +224,9 @@
       bool
>::type eval_eq(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
 {
+ BOOST_MP_USING_ABS
    typedef typename make_unsigned<S>::type ui_type;
- return (a.sign() == (b < 0)) && (*a.limbs() == static_cast<ui_type>(std::abs(b)));
+ return (a.sign() == (b < 0)) && (*a.limbs() == static_cast<ui_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
 BOOST_FORCEINLINE typename enable_if_c<
@@ -284,10 +288,11 @@
       bool
>::type eval_lt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
 {
+ BOOST_MP_USING_ABS
    typedef typename make_unsigned<S>::type ui_type;
    if(a.sign() != (b < 0))
       return a.sign();
- return a.sign() ? (*a.limbs() > static_cast<ui_type>(std::abs(b))) : (*a.limbs() < static_cast<ui_type>(std::abs(b)));
+ return a.sign() ? (*a.limbs() > static_cast<ui_type>(abs(b))) : (*a.limbs() < static_cast<ui_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
 BOOST_FORCEINLINE typename enable_if_c<
@@ -349,10 +354,11 @@
       bool
>::type eval_gt(const cpp_int_backend<MinBits, MaxBits, signed_magnitude, Checked, void>& a, S b) BOOST_NOEXCEPT
 {
+ BOOST_MP_USING_ABS
    typedef typename make_unsigned<S>::type ui_type;
    if(a.sign() != (b < 0))
       return !a.sign();
- return a.sign() ? (*a.limbs() < static_cast<ui_type>(std::abs(b))) : (*a.limbs() > static_cast<ui_type>(std::abs(b)));
+ return a.sign() ? (*a.limbs() < static_cast<ui_type>(abs(b))) : (*a.limbs() > static_cast<ui_type>(abs(b)));
 }
 template <unsigned MinBits, unsigned MaxBits, cpp_int_check_type Checked, class U>
 BOOST_FORCEINLINE typename enable_if_c<

Modified: trunk/boost/multiprecision/cpp_int/misc.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/misc.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/misc.hpp 2012-11-19 08:30:33 EST (Mon, 19 Nov 2012)
@@ -241,8 +241,9 @@
 BOOST_FORCEINLINE typename enable_if_c<is_signed<Integer>::value && !is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value, Integer>::type
    eval_integer_modulus(const cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& x, Integer val)
 {
+ BOOST_MP_USING_ABS
    typedef typename make_unsigned<Integer>::type unsigned_type;
- return eval_integer_modulus(x, static_cast<unsigned_type>(std::abs(val)));
+ return eval_integer_modulus(x, static_cast<unsigned_type>(abs(val)));
 }
 
 //


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk