Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions extra/haertel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#ifndef BOOST_RANDOM_HAERTEL_HPP
#define BOOST_RANDOM_HAERTEL_HPP

#include <boost/cstdint.hpp>
#include <cstdint>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/inversive_congruential.hpp>

Expand Down Expand Up @@ -127,29 +127,29 @@ class lagged_fibonacci_int
// distributions from Haertel's dissertation
// (additional parameterizations of the basic templates)
namespace Haertel {
typedef boost::random::linear_congruential<boost::uint64_t, 45965, 453816691,
(boost::uint64_t(1)<<31), 0> LCG_Af2;
typedef boost::random::linear_congruential<boost::uint64_t, 211936855, 0,
(boost::uint64_t(1)<<29)-3, 0> LCG_Die1;
typedef boost::random::linear_congruential<boost::uint32_t, 2824527309u, 0,
typedef boost::random::linear_congruential<std::uint64_t, 45965, 453816691,
(std::uint64_t(1)<<31), 0> LCG_Af2;
typedef boost::random::linear_congruential<std::uint64_t, 211936855, 0,
(std::uint64_t(1)<<29)-3, 0> LCG_Die1;
typedef boost::random::linear_congruential<std::uint32_t, 2824527309u, 0,
0, 0> LCG_Fis;
typedef boost::random::linear_congruential<boost::uint64_t, 950706376u, 0,
(boost::uint64_t(1)<<31)-1, 0> LCG_FM;
typedef boost::random::linear_congruential<boost::int32_t, 51081, 0,
typedef boost::random::linear_congruential<std::uint64_t, 950706376u, 0,
(std::uint64_t(1)<<31)-1, 0> LCG_FM;
typedef boost::random::linear_congruential<std::int32_t, 51081, 0,
2147483647, 0> LCG_Hae;
typedef boost::random::linear_congruential<boost::uint32_t, 69069, 1,
typedef boost::random::linear_congruential<std::uint32_t, 69069, 1,
0, 0> LCG_VAX;
typedef boost::random::inversive_congruential<boost::int64_t, 240318, 197,
typedef boost::random::inversive_congruential<std::int64_t, 240318, 197,
1000081, 0> NLG_Inv1;
typedef boost::random::inversive_congruential<boost::int64_t, 15707262,
typedef boost::random::inversive_congruential<std::int64_t, 15707262,
13262967, (1<<24)-17, 0> NLG_Inv2;
typedef boost::random::inversive_congruential<boost::int32_t, 1, 1,
typedef boost::random::inversive_congruential<std::int32_t, 1, 1,
2147483647, 0> NLG_Inv4;
typedef boost::random::inversive_congruential<boost::int32_t, 1, 2,
typedef boost::random::inversive_congruential<std::int32_t, 1, 2,
1<<30, 0> NLG_Inv5;
typedef boost::random::additive_congruential<boost::int32_t, 6,
typedef boost::random::additive_congruential<std::int32_t, 6,
(1<<30)-35, 0> MRG_Acorn7;
typedef boost::random::lagged_fibonacci_int<boost::uint32_t, 607, 273,
typedef boost::random::lagged_fibonacci_int<std::uint32_t, 607, 273,
0, 0> MRG_Fib2;
} // namespace Haertel

Expand Down
4 changes: 2 additions & 2 deletions include/boost/random/additive_combine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#ifndef BOOST_RANDOM_ADDITIVE_COMBINE_HPP
#define BOOST_RANDOM_ADDITIVE_COMBINE_HPP

#include <cstdint>
#include <istream>
#include <iosfwd>
#include <algorithm> // for std::min and std::max
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/random/detail/config.hpp>
#include <boost/random/detail/operators.hpp>
#include <boost/random/detail/seed.hpp>
Expand Down Expand Up @@ -196,7 +196,7 @@ class additive_combine_engine
{ detail::generate_from_int(*this, first, last); }

/** Advances the state of the generator by @c z. */
void discard(boost::uintmax_t z)
void discard(std::uintmax_t z)
{
_mlcg1.discard(z);
_mlcg2.discard(z);
Expand Down
1 change: 1 addition & 0 deletions include/boost/random/binomial_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <boost/config/no_tr1/cmath.hpp>
#include <cstdlib>
#include <iosfwd>
#include <limits>

#include <boost/random/detail/config.hpp>
#include <boost/random/uniform_01.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/boost/random/cauchy_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <boost/config/no_tr1/cmath.hpp>
#include <iosfwd>
#include <istream>
#include <boost/limits.hpp>
#include <limits>
#include <boost/random/detail/config.hpp>
#include <boost/random/detail/operators.hpp>
#include <boost/random/uniform_01.hpp>
Expand Down
2 changes: 1 addition & 1 deletion include/boost/random/chi_squared_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define BOOST_RANDOM_CHI_SQUARED_DISTRIBUTION_HPP_INCLUDED

#include <iosfwd>
#include <boost/limits.hpp>
#include <limits>

#include <boost/random/detail/config.hpp>
#include <boost/random/gamma_distribution.hpp>
Expand Down
10 changes: 6 additions & 4 deletions include/boost/random/detail/const_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef BOOST_RANDOM_CONST_MOD_HPP
#define BOOST_RANDOM_CONST_MOD_HPP

#include <cstdint>
#include <limits>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/integer_traits.hpp>
Expand Down Expand Up @@ -84,7 +86,7 @@ class const_mod
return add(mult(a, x), c);
}

static IntType pow(IntType a, boost::uintmax_t exponent)
static IntType pow(IntType a, std::uintmax_t exponent)
{
IntType result = 1;
while(exponent != 0) {
Expand Down Expand Up @@ -129,10 +131,10 @@ class const_mod
BOOST_ASSERT(suppress_warnings == 0);
IntType modulus = m + suppress_warnings;
BOOST_ASSERT(modulus == m);
if(::boost::uintmax_t(modulus) <=
(::std::numeric_limits< ::boost::uintmax_t>::max)() / modulus)
if(std::uintmax_t(modulus) <=
(std::numeric_limits< std::uintmax_t>::max)() / modulus)
{
return static_cast<IntType>(boost::uintmax_t(a) * b % modulus);
return static_cast<IntType>(std::uintmax_t(a) * b % modulus);
} else {
return static_cast<IntType>(detail::mulmod(a, b, modulus));
}
Expand Down
2 changes: 1 addition & 1 deletion include/boost/random/detail/generator_bits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP
#define BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP

#include <boost/limits.hpp>
#include <limits>

namespace boost {
namespace random {
Expand Down
1 change: 1 addition & 0 deletions include/boost/random/detail/gray_coded_qrng.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <boost/core/bit.hpp> // lsb
#include <boost/throw_exception.hpp>
#include <limits>
#include <stdexcept>

#include <functional> // bit_xor
Expand Down
1 change: 1 addition & 0 deletions include/boost/random/detail/int_float_pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef BOOST_RANDOM_DETAIL_INT_FLOAT_PAIR_HPP
#define BOOST_RANDOM_DETAIL_INT_FLOAT_PAIR_HPP

#include <limits>
#include <utility>
#include <boost/integer.hpp>
#include <boost/integer/integer_mask.hpp>
Expand Down
4 changes: 2 additions & 2 deletions include/boost/random/detail/integer_log2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#ifndef BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
#define BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP

#include <limits>
#include <boost/config.hpp>
#include <boost/limits.hpp>
#include <boost/integer/integer_log2.hpp>

namespace boost {
Expand Down Expand Up @@ -72,7 +72,7 @@ BOOST_RANDOM_DETAIL_CONSTEXPR int integer_log2(T t)
{
return integer_log2_impl<
::boost::detail::max_pow2_less<
::std::numeric_limits<T>::digits, 4
std::numeric_limits<T>::digits, 4
>::value
>::apply(t, 0);
}
Expand Down
40 changes: 20 additions & 20 deletions include/boost/random/detail/large_arithmetic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#ifndef BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP
#define BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP

#include <boost/cstdint.hpp>
#include <cstdint>
#include <limits>
#include <boost/integer.hpp>
#include <boost/limits.hpp>
#include <boost/random/detail/integer_log2.hpp>

#include <boost/random/detail/disable_warnings.hpp>
Expand All @@ -25,18 +25,18 @@ namespace random {
namespace detail {

struct div_t {
boost::uintmax_t quotient;
boost::uintmax_t remainder;
std::uintmax_t quotient;
std::uintmax_t remainder;
};

inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m)
inline div_t muldivmod(std::uintmax_t a, std::uintmax_t b, std::uintmax_t m)
{
const int bits =
::std::numeric_limits< ::boost::uintmax_t>::digits / 2;
const ::boost::uintmax_t mask = (::boost::uintmax_t(1) << bits) - 1;
std::numeric_limits< std::uintmax_t>::digits / 2;
const std::uintmax_t mask = (std::uintmax_t(1) << bits) - 1;
typedef ::boost::uint_t<bits>::fast digit_t;

int shift = std::numeric_limits< ::boost::uintmax_t>::digits - 1
int shift = std::numeric_limits< std::uintmax_t>::digits - 1
- detail::integer_log2(m);

a <<= shift;
Expand All @@ -51,7 +51,7 @@ inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t
for(int i = 0; i < 2; ++i) {
digit_t carry = 0;
for(int j = 0; j < 2; ++j) {
::boost::uint64_t temp = ::boost::uintmax_t(a_[i]) * b_[j] +
std::uint64_t temp = std::uintmax_t(a_[i]) * b_[j] +
carry + product[i + j];
product[i + j] = digit_t(temp & mask);
carry = digit_t(temp >> bits);
Expand All @@ -65,23 +65,23 @@ inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t

if(m == 0) {
div_t result = {
((::boost::uintmax_t(product[3]) << bits) | product[2]),
((::boost::uintmax_t(product[1]) << bits) | product[0]) >> shift,
((std::uintmax_t(product[3]) << bits) | product[2]),
((std::uintmax_t(product[1]) << bits) | product[0]) >> shift,
};
return result;
}

// divide product / m
for(int i = 3; i >= 2; --i) {
::boost::uintmax_t temp =
::boost::uintmax_t(product[i]) << bits | product[i - 1];
std::uintmax_t temp =
std::uintmax_t(product[i]) << bits | product[i - 1];

digit_t q = digit_t((product[i] == m_[1]) ? mask : temp / m_[1]);

::boost::uintmax_t rem =
((temp - ::boost::uintmax_t(q) * m_[1]) << bits) + product[i - 2];
std::uintmax_t rem =
((temp - std::uintmax_t(q) * m_[1]) << bits) + product[i - 2];

::boost::uintmax_t diff = m_[0] * ::boost::uintmax_t(q);
std::uintmax_t diff = m_[0] * std::uintmax_t(q);

int error = 0;
if(diff > rem) {
Expand All @@ -101,16 +101,16 @@ inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t
}

div_t result = {
((::boost::uintmax_t(quotient[1]) << bits) | quotient[0]),
((::boost::uintmax_t(product[1]) << bits) | product[0]) >> shift,
((std::uintmax_t(quotient[1]) << bits) | quotient[0]),
((std::uintmax_t(product[1]) << bits) | product[0]) >> shift,
};
return result;
}

inline boost::uintmax_t muldiv(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m)
inline std::uintmax_t muldiv(std::uintmax_t a, std::uintmax_t b, std::uintmax_t m)
{ return detail::muldivmod(a, b, m).quotient; }

inline boost::uintmax_t mulmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m)
inline std::uintmax_t mulmod(std::uintmax_t a, std::uintmax_t b, std::uintmax_t m)
{ return detail::muldivmod(a, b, m).remainder; }

} // namespace detail
Expand Down
14 changes: 7 additions & 7 deletions include/boost/random/detail/polynomial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#ifndef BOOST_RANDOM_DETAIL_POLYNOMIAL_HPP
#define BOOST_RANDOM_DETAIL_POLYNOMIAL_HPP

#include <cstdint>
#include <cstddef>
#include <limits>
#include <vector>
#include <algorithm>
#include <boost/assert.hpp>
#include <boost/cstdint.hpp>

namespace boost {
namespace random {
Expand Down Expand Up @@ -246,7 +246,7 @@ class polynomial_ops {
// base should have the same number of bits as mod
// base, and mod should both be able to hold a power
// of 2 >= mod_bits. out needs to be twice as large.
static void mod_pow_x(boost::uintmax_t exponent, const digit_t * mod, std::size_t mod_bits, digit_t * out)
static void mod_pow_x(std::uintmax_t exponent, const digit_t * mod, std::size_t mod_bits, digit_t * out)
{
const std::size_t bits = std::numeric_limits<digit_t>::digits;
const std::size_t n = (mod_bits + bits - 1) / bits;
Expand All @@ -256,8 +256,8 @@ class polynomial_ops {
std::fill_n(out + 1, n - 1, digit_t(0));
return;
}
boost::uintmax_t i = std::numeric_limits<boost::uintmax_t>::digits - 1;
while(((boost::uintmax_t(1) << i) & exponent) == 0) {
std::uintmax_t i = std::numeric_limits<std::uintmax_t>::digits - 1;
while(((std::uintmax_t(1) << i) & exponent) == 0) {
--i;
}
out[0] = 2;
Expand All @@ -266,7 +266,7 @@ class polynomial_ops {
while(i--) {
sqr(out, n);
m(out, 2 * mod_bits - 1);
if((boost::uintmax_t(1) << i) & exponent) {
if((std::uintmax_t(1) << i) & exponent) {
shift_left(out, n, 1);
if(out[highbit / bits] & (digit_t(1) << highbit%bits))
add(n, out, mod, out);
Expand Down Expand Up @@ -337,7 +337,7 @@ class polynomial
_size = n;
}
friend polynomial operator*(const polynomial &lhs, const polynomial &rhs);
friend polynomial mod_pow_x(boost::uintmax_t exponent, polynomial mod);
friend polynomial mod_pow_x(std::uintmax_t exponent, polynomial mod);
private:
std::vector<polynomial_ops::digit_t> _storage;
std::size_t _size;
Expand Down Expand Up @@ -365,7 +365,7 @@ inline polynomial operator*(const polynomial &lhs, const polynomial &rhs)
return result;
}

inline polynomial mod_pow_x(boost::uintmax_t exponent, polynomial mod)
inline polynomial mod_pow_x(std::uintmax_t exponent, polynomial mod)
{
polynomial result;
mod.normalize();
Expand Down
Loading
Loading