3ee44d4c51
This ensures that intermediate results are done in uint32_t values, meeting the requirement for operations to be done modulo 2^32. If the target doesn't define __UINT32_TYPE__ then substitute uint32_t with a class type that uses uint_least32_t and masks the value to UINT32_MAX. I've also split the first loop that goes from k=0 to k<m into three loops, for k=0, [1,s] and [s+1,m). This avoids branching for those three cases in the body of the loop, and also avoids the concerns in PR 94823 regarding the k-1 index when k==0. libstdc++-v3/ChangeLog: PR libstdc++/97311 * include/bits/random.tcc (seed_seq::generate): Use uint32_t for calculations. Also split the first loop into three loops to avoid branching on k on every iteration, resolving PR 94823. * testsuite/26_numerics/random/seed_seq/97311.cc: New test. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-erro line number. |
||
---|---|---|
.. | ||
bernoulli_distribution | ||
binomial_distribution | ||
cauchy_distribution | ||
chi_squared_distribution | ||
discard_block_engine | ||
discrete_distribution | ||
exponential_distribution | ||
extreme_value_distribution | ||
fisher_f_distribution | ||
gamma_distribution | ||
geometric_distribution | ||
independent_bits_engine | ||
linear_congruential_engine | ||
lognormal_distribution | ||
mersenne_twister_engine | ||
negative_binomial_distribution | ||
normal_distribution | ||
piecewise_constant_distribution | ||
piecewise_linear_distribution | ||
poisson_distribution | ||
random_device | ||
seed_seq | ||
shuffle_order_engine | ||
student_t_distribution | ||
subtract_with_carry_engine | ||
uniform_int_distribution | ||
uniform_real_distribution | ||
weibull_distribution | ||
concept.cc | ||
default_random_engine.cc | ||
knuth_b.cc | ||
minstd_rand0.cc | ||
minstd_rand.cc | ||
mt19937_64.cc | ||
mt19937.cc | ||
pr60037-neg.cc | ||
ranlux24_base.cc | ||
ranlux24.cc | ||
ranlux48_base.cc | ||
ranlux48.cc |