diff options
author | 2020-10-03 14:31:39 +1000 | |
---|---|---|
committer | 2020-10-03 14:31:39 +1000 | |
commit | d1681a8ecef978ee34bafe24e95d34f25581e9c3 (patch) | |
tree | 958f96e617f2b5cb3c7c74536a14ad19d9a45be7 /src/lib/netlist/plib/prandom.h | |
parent | b7de847b6e5f259fa5c67b43951586204a6ae387 (diff) | |
parent | 9ac531e2b9aa690910cbeb35a14bd93fb001592b (diff) |
Merge remote-tracking branch 'upstream/master' into master
Diffstat (limited to 'src/lib/netlist/plib/prandom.h')
-rw-r--r-- | src/lib/netlist/plib/prandom.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/netlist/plib/prandom.h b/src/lib/netlist/plib/prandom.h index b2f9c89a9cf..669228f23fe 100644 --- a/src/lib/netlist/plib/prandom.h +++ b/src/lib/netlist/plib/prandom.h @@ -101,7 +101,7 @@ namespace plib } private: - void twist() + void twist() noexcept { const T lowest_w(~T(0) >> (sizeof(T)*8 - w)); const T lower_mask((T(1) << r) - 1); // That is, the binary number of r 1's @@ -121,10 +121,10 @@ namespace plib }; template <typename FT, typename T> - FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) + FT normalize_uniform(T &p, FT m = constants<FT>::one(), FT b = constants<FT>::zero()) noexcept { - const auto mmin(narrow_cast<FT>(p.min())); - const auto mmax(narrow_cast<FT>(p.max())); + constexpr const auto mmin(narrow_cast<FT>(T::min())); + constexpr const auto mmax(narrow_cast<FT>(T::max())); // -> 0 to a return (narrow_cast<FT>(p())- mmin) / (mmax - mmin) * m - b; } |