/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
generateCanonical(Rng &g)
{
// No point in using more bits than fit in RealType
- const gmx_uint64_t digits = std::numeric_limits<RealType>::digits;
- const gmx_uint64_t realBits = std::min(digits, static_cast<gmx_uint64_t>(Bits));
- const gmx_uint64_t range = Rng::max() - Rng::min() + gmx_uint64_t(1);
- gmx_uint64_t log2R = (range == 0) ? std::numeric_limits<gmx_uint64_t>::digits : log2I(range);
- gmx_uint64_t k = realBits / log2R + (realBits % log2R != 0) + (realBits == 0);
+ const uint64_t digits = std::numeric_limits<RealType>::digits;
+ const uint64_t realBits = std::min(digits, static_cast<uint64_t>(Bits));
+ const uint64_t range = Rng::max() - Rng::min() + uint64_t(1);
+ uint64_t log2R = (range == 0) ? std::numeric_limits<uint64_t>::digits : log2I(range);
+ uint64_t k = realBits / log2R + (realBits % log2R != 0) + (realBits == 0);
RealType r = Rng::max() - Rng::min() + RealType(1);
RealType s = g() - Rng::min();
RealType base = r;
RealType result;
- for (gmx_uint64_t i = 1; i < k; ++i)
+ for (uint64_t i = 1; i < k; ++i)
{
s += RealType(g()-Rng::min()) * base;
base *= r;