diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/random | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/random')
17 files changed, 92 insertions, 89 deletions
diff --git a/3rdParty/Boost/src/boost/random/detail/config.hpp b/3rdParty/Boost/src/boost/random/detail/config.hpp index d6bc0cc..724ab19 100644 --- a/3rdParty/Boost/src/boost/random/detail/config.hpp +++ b/3rdParty/Boost/src/boost/random/detail/config.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: config.hpp 52492 2009-04-19 14:55:57Z steven_watanabe $ + * $Id$ */ #include <boost/config.hpp> diff --git a/3rdParty/Boost/src/boost/random/detail/const_mod.hpp b/3rdParty/Boost/src/boost/random/detail/const_mod.hpp index 9778f55..07f4ea7 100644 --- a/3rdParty/Boost/src/boost/random/detail/const_mod.hpp +++ b/3rdParty/Boost/src/boost/random/detail/const_mod.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: const_mod.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * * Revision history * 2001-02-18 moved to individual header files diff --git a/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp b/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp index f3ade5e..d875004 100644 --- a/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp +++ b/3rdParty/Boost/src/boost/random/detail/disable_warnings.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: disable_warnings.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id$ * */ @@ -21,3 +21,8 @@ #pragma warning(disable:4127) #pragma warning(disable:4724) #endif + +#if defined(BOOST_GCC) && BOOST_GCC >= 40600 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp b/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp index 26184ea..24f3bb3 100644 --- a/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp +++ b/3rdParty/Boost/src/boost/random/detail/enable_warnings.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: enable_warnings.hpp 58649 2010-01-02 21:23:17Z steven_watanabe $ + * $Id$ * */ @@ -16,3 +16,7 @@ #ifdef BOOST_MSVC #pragma warning(pop) #endif + +#if defined(BOOST_GCC) && BOOST_GCC >= 40600 +#pragma GCC diagnostic pop +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp b/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp index 44b4248..0527614 100644 --- a/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp +++ b/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: generator_bits.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * $Id$ * */ diff --git a/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp b/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp index 6aaf98f..7e13483 100644 --- a/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp +++ b/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp @@ -8,7 +8,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: generator_seed_seq.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * */ diff --git a/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp b/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp index baee426..248243a 100644 --- a/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp +++ b/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: integer_log2.hpp 76145 2011-12-24 19:05:17Z danieljames $ + * $Id$ * */ @@ -22,12 +22,12 @@ namespace boost { namespace random { namespace detail { -#if !defined(BOOST_NO_CONSTEXPR) +#if !defined(BOOST_NO_CXX11_CONSTEXPR) #define BOOST_RANDOM_DETAIL_CONSTEXPR constexpr #elif defined(BOOST_MSVC) #define BOOST_RANDOM_DETAIL_CONSTEXPR __forceinline #elif defined(__GNUC__) && __GNUC__ >= 4 -#define BOOST_RANDOM_DETAIL_CONSTEXPR __attribute__((const)) __attribute__((always_inline)) +#define BOOST_RANDOM_DETAIL_CONSTEXPR inline __attribute__((__const__)) __attribute__((__always_inline__)) #else #define BOOST_RANDOM_DETAIL_CONSTEXPR inline #endif @@ -35,7 +35,7 @@ namespace detail { template<int Shift> struct integer_log2_impl { -#if defined(BOOST_NO_CONSTEXPR) +#if defined(BOOST_NO_CXX11_CONSTEXPR) template<class T> BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) { diff --git a/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp b/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp index 24177dc..66f6b4e 100644 --- a/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp +++ b/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: large_arithmetic.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP @@ -31,9 +31,9 @@ struct div_t { inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) { - static const int bits = + const int bits = ::std::numeric_limits< ::boost::uintmax_t>::digits / 2; - static const ::boost::uintmax_t mask = (::boost::uintmax_t(1) << bits) - 1; + const ::boost::uintmax_t mask = (::boost::uintmax_t(1) << bits) - 1; typedef ::boost::uint_t<bits>::fast digit_t; int shift = std::numeric_limits< ::boost::uintmax_t>::digits - 1 @@ -96,8 +96,8 @@ inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t quotient[i - 2] = q; product[i] = 0; - product[i-1] = (rem >> bits) & mask; - product[i-2] = rem & mask; + product[i-1] = static_cast<digit_t>((rem >> bits) & mask); + product[i-2] = static_cast<digit_t>(rem & mask); } div_t result = { diff --git a/3rdParty/Boost/src/boost/random/detail/operators.hpp b/3rdParty/Boost/src/boost/random/detail/operators.hpp index f27839a..597343c 100644 --- a/3rdParty/Boost/src/boost/random/detail/operators.hpp +++ b/3rdParty/Boost/src/boost/random/detail/operators.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: operators.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_OPERATORS_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp b/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp index 3f3fbdd..f1b983d 100644 --- a/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp +++ b/3rdParty/Boost/src/boost/random/detail/ptr_helper.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: ptr_helper.hpp 24096 2004-07-27 03:43:34Z dgregor $ + * $Id$ * */ @@ -32,7 +32,6 @@ struct ptr_helper static const T& ref(const T& r) { return r; } }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template<class T> struct ptr_helper<T&> { @@ -52,7 +51,6 @@ struct ptr_helper<T*> static reference_type ref(T * p) { return *p; } static const T& ref(const T * p) { return *p; } }; -#endif } // namespace detail } // namespace random @@ -64,31 +62,6 @@ struct ptr_helper<T*> // Helper macro for broken compilers defines specializations of // ptr_helper. // -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# define BOOST_RANDOM_PTR_HELPER_SPEC(T) \ -namespace boost { namespace random { namespace detail { \ -template<> \ -struct ptr_helper<T&> \ -{ \ - typedef T value_type; \ - typedef T& reference_type; \ - typedef T& rvalue_type; \ - static reference_type ref(T& r) { return r; } \ - static const T& ref(const T& r) { return r; } \ -}; \ - \ -template<> \ -struct ptr_helper<T*> \ -{ \ - typedef T value_type; \ - typedef T& reference_type; \ - typedef T* rvalue_type; \ - static reference_type ref(T * p) { return *p; } \ - static const T& ref(const T * p) { return *p; } \ -}; \ -}}} -#else # define BOOST_RANDOM_PTR_HELPER_SPEC(T) -#endif #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/seed.hpp b/3rdParty/Boost/src/boost/random/detail/seed.hpp index 979db29..55b2fa6 100644 --- a/3rdParty/Boost/src/boost/random/detail/seed.hpp +++ b/3rdParty/Boost/src/boost/random/detail/seed.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: seed.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_SEED_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp b/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp index e044d45..f88cab2 100644 --- a/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp +++ b/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: seed_impl.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * $Id$ */ #ifndef BOOST_RANDOM_DETAIL_SEED_IMPL_HPP @@ -15,6 +15,7 @@ #include <stdexcept> #include <boost/cstdint.hpp> +#include <boost/throw_exception.hpp> #include <boost/config/no_tr1/cmath.hpp> #include <boost/integer/integer_mask.hpp> #include <boost/integer/static_log2.hpp> @@ -253,7 +254,7 @@ IntType get_one_int(Iter& first, Iter last) IntType s = 0; for(int j = 0; j < k; ++j) { if(first == last) { - throw ::std::invalid_argument("Not enough elements in call to seed."); + boost::throw_exception(::std::invalid_argument("Not enough elements in call to seed.")); } IntType digit = const_mod<IntType, m>::apply(IntType(*first++)); IntType mult = IntType(1) << 32*j; @@ -303,7 +304,7 @@ void fill_array_int_impl(Iter& first, Iter last, UIntType (&x)[n]) UIntType val = 0; for(std::size_t k = 0; k < (w+31)/32; ++k) { if(first == last) { - throw std::invalid_argument("Not enough elements in call to seed."); + boost::throw_exception(std::invalid_argument("Not enough elements in call to seed.")); } val += static_cast<UIntType>(*first++) << 32*k; } @@ -373,12 +374,12 @@ void fill_array_real(Iter& first, Iter last, RealType (&x)[n]) RealType val = RealType(0); RealType mult = divisor; for(int k = 0; k < w/32; ++k, ++first) { - if(first == last) throw std::invalid_argument("Not enough elements in call to seed."); + if(first == last) boost::throw_exception(std::invalid_argument("Not enough elements in call to seed.")); val += *first * mult; mult *= two32; } if(mask != 0) { - if(first == last) throw std::invalid_argument("Not enough elements in call to seed."); + if(first == last) boost::throw_exception(std::invalid_argument("Not enough elements in call to seed.")); val += (*first & mask) * mult; ++first; } diff --git a/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp b/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp index ef20915..393c455 100644 --- a/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp +++ b/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp @@ -8,7 +8,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int_float.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * $Id$ * */ diff --git a/3rdParty/Boost/src/boost/random/mersenne_twister.hpp b/3rdParty/Boost/src/boost/random/mersenne_twister.hpp index be60389..3878fee 100644 --- a/3rdParty/Boost/src/boost/random/mersenne_twister.hpp +++ b/3rdParty/Boost/src/boost/random/mersenne_twister.hpp @@ -8,9 +8,10 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: mersenne_twister.hpp 74867 2011-10-09 23:13:31Z steven_watanabe $ + * $Id$ * * Revision history + * 2013-10-14 fixed some warnings with Wshadow (mgaunard) * 2001-02-18 moved to individual header files */ @@ -40,7 +41,7 @@ namespace random { * "Mersenne Twister: A 623-dimensionally equidistributed uniform * pseudo-random number generator", Makoto Matsumoto and Takuji Nishimura, * ACM Transactions on Modeling and Computer Simulation: Special Issue on - * Uniform Random Number Generation, Vol. 8, No. 1, January 1998, pp. 3-30. + * Uniform Random Number Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote * * @xmlnote @@ -51,7 +52,7 @@ namespace random { * * The seeding from an integer was changed in April 2005 to address a * <a href="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html">weakness</a>. - * + * * The quality of the generator crucially depends on the choice of the * parameters. User code should employ one of the sensibly parameterized * generators such as \mt19937 instead. @@ -83,7 +84,7 @@ public: BOOST_STATIC_CONSTANT(std::size_t, tempering_l = l); BOOST_STATIC_CONSTANT(UIntType, initialization_multiplier = f); BOOST_STATIC_CONSTANT(UIntType, default_seed = 5489u); - + // backwards compatibility BOOST_STATIC_CONSTANT(UIntType, parameter_a = a); BOOST_STATIC_CONSTANT(std::size_t, output_u = u); @@ -92,7 +93,7 @@ public: BOOST_STATIC_CONSTANT(std::size_t, output_t = t); BOOST_STATIC_CONSTANT(UIntType, output_c = c); BOOST_STATIC_CONSTANT(std::size_t, output_l = l); - + // old Boost.Random concept requirements BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); @@ -136,7 +137,7 @@ public: */ BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(mersenne_twister_engine, UIntType, value) { - // New seeding algorithm from + // New seeding algorithm from // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html // In the previous versions, MSBs of the seed affected only MSBs of the // state x[]. @@ -147,8 +148,10 @@ public: // Vol. 2, 3rd ed., page 106 x[i] = (f * (x[i-1] ^ (x[i-1] >> (w-2))) + i) & mask; } + + normalize_state(); } - + /** * Seeds a mersenne_twister_engine using values produced by seq.generate(). */ @@ -157,13 +160,7 @@ public: detail::seed_array_int<w>(seq, x); i = n; - // fix up the state if it's all zeroes. - if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) { - for(std::size_t j = 1; j < n; ++j) { - if(x[j] != 0) return; - } - x[0] = static_cast<UIntType>(1) << (w-1); - } + normalize_state(); } /** Sets the state of the generator using values from an iterator range. */ @@ -173,22 +170,16 @@ public: detail::fill_array_int<w>(first, last, x); i = n; - // fix up the state if it's all zeroes. - if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) { - for(std::size_t j = 1; j < n; ++j) { - if(x[j] != 0) return; - } - x[0] = static_cast<UIntType>(1) << (w-1); - } + normalize_state(); } - + /** Returns the smallest value that the generator can produce. */ static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; } /** Returns the largest value that the generator can produce. */ static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () { return boost::low_bits_mask_t<w>::sig_bits; } - + /** Produces the next value of the generator. */ result_type operator()(); @@ -223,7 +214,7 @@ public: mt.print(os); return os; } - + /** Reads a mersenne_twister_engine from a @c std::istream */ template<class CharT, class Traits> friend std::basic_istream<CharT,Traits>& @@ -244,19 +235,19 @@ public: * Returns true if the two generators are in the same state, * and will thus produce identical sequences. */ - friend bool operator==(const mersenne_twister_engine& x, - const mersenne_twister_engine& y) + friend bool operator==(const mersenne_twister_engine& x_, + const mersenne_twister_engine& y_) { - if(x.i < y.i) return x.equal_imp(y); - else return y.equal_imp(x); + if(x_.i < y_.i) return x_.equal_imp(y_); + else return y_.equal_imp(x_); } - + /** * Returns true if the two generators are in different states. */ - friend bool operator!=(const mersenne_twister_engine& x, - const mersenne_twister_engine& y) - { return !(x == y); } + friend bool operator!=(const mersenne_twister_engine& x_, + const mersenne_twister_engine& y_) + { return !(x_ == y_); } private: /// \cond show_private @@ -333,6 +324,35 @@ private: } /** + * Converts an arbitrary array into a valid generator state. + * First we normalize x[0], so that it contains the same + * value we would get by running the generator forwards + * and then in reverse. (The low order r bits are redundant). + * Then, if the state consists of all zeros, we set the + * high order bit of x[0] to 1. This function only needs to + * be called by seed, since the state transform preserves + * this relationship. + */ + void normalize_state() + { + const UIntType upper_mask = (~static_cast<UIntType>(0)) << r; + const UIntType lower_mask = ~upper_mask; + UIntType y0 = x[m-1] ^ x[n-1]; + if(y0 & (static_cast<UIntType>(1) << (w-1))) { + y0 = ((y0 ^ a) << 1) | 1; + } else { + y0 = y0 << 1; + } + x[0] = (x[0] & upper_mask) | (y0 & lower_mask); + + // fix up the state if it's all zeroes. + for(std::size_t j = 0; j < n; ++j) { + if(x[j] != 0) return; + } + x[0] = static_cast<UIntType>(1) << (w-1); + } + + /** * Given a pointer to the last element of the rewind array, * and the current size of the rewind array, finds an element * relative to the next available slot in the rewind array. @@ -354,7 +374,7 @@ private: // x[0] ... x[k] x[k+1] ... x[n-1] represents // x(i-k) ... x(i) x(i+1) ... x(i-k+n-1) - UIntType x[n]; + UIntType x[n]; std::size_t i; }; @@ -468,7 +488,7 @@ mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::operator()() * uniform pseudo-random number generator", Makoto Matsumoto * and Takuji Nishimura, ACM Transactions on Modeling and * Computer Simulation: Special Issue on Uniform Random Number - * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. + * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote */ typedef mersenne_twister_engine<uint32_t,32,351,175,19,0xccab8ee7, @@ -482,7 +502,7 @@ typedef mersenne_twister_engine<uint32_t,32,351,175,19,0xccab8ee7, * uniform pseudo-random number generator", Makoto Matsumoto * and Takuji Nishimura, ACM Transactions on Modeling and * Computer Simulation: Special Issue on Uniform Random Number - * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. + * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote */ typedef mersenne_twister_engine<uint32_t,32,624,397,31,0x9908b0df, diff --git a/3rdParty/Boost/src/boost/random/uniform_int.hpp b/3rdParty/Boost/src/boost/random/uniform_int.hpp index 7ae3b92..4362652 100644 --- a/3rdParty/Boost/src/boost/random/uniform_int.hpp +++ b/3rdParty/Boost/src/boost/random/uniform_int.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * * Revision history * 2001-04-08 added min<max assertion (N. Becker) diff --git a/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp b/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp index 0612028..a175025 100644 --- a/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp +++ b/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp @@ -8,7 +8,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int_distribution.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * * Revision history * 2001-04-08 added min<max assertion (N. Becker) diff --git a/3rdParty/Boost/src/boost/random/variate_generator.hpp b/3rdParty/Boost/src/boost/random/variate_generator.hpp index ac69800..6d5aac4 100644 --- a/3rdParty/Boost/src/boost/random/variate_generator.hpp +++ b/3rdParty/Boost/src/boost/random/variate_generator.hpp @@ -8,7 +8,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: variate_generator.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * $Id$ * */ |