diff options
author | Paolo Carlini <pcarlini@suse.de> | 2006-06-16 00:04:43 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2006-06-16 00:04:43 +0000 |
commit | f28e0f45260d6bd97e3ecbf52ba41815e158a60c (patch) | |
tree | a3a514624c4fd0a1acc3c1e78a6baa5ba0d9cdd8 /libstdc++-v3 | |
parent | 92a36a4a459db47d8cf74cd0c4c1220170ba56fc (diff) | |
download | gcc-f28e0f45260d6bd97e3ecbf52ba41815e158a60c.zip gcc-f28e0f45260d6bd97e3ecbf52ba41815e158a60c.tar.gz gcc-f28e0f45260d6bd97e3ecbf52ba41815e158a60c.tar.bz2 |
random.tcc (mersenne_twister<>::operator()()): Reload the last position of the _M_x vector too.
2006-06-15 Paolo Carlini <pcarlini@suse.de>
* include/tr1/random.tcc (mersenne_twister<>::operator()()):
Reload the last position of the _M_x vector too.
From-SVN: r114695
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/random.tcc | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4e299c1..0d20d2a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2006-06-15 Paolo Carlini <pcarlini@suse.de> + * include/tr1/random.tcc (mersenne_twister<>::operator()()): + Reload the last position of the _M_x vector too. + +2006-06-15 Paolo Carlini <pcarlini@suse.de> + * include/tr1/random (class xor_combine): Fix result_type typedef. * testsuite/tr1/5_numerical_facilities/random/xor_combine/ cons/default.cc: New. diff --git a/libstdc++-v3/include/tr1/random.tcc b/libstdc++-v3/include/tr1/random.tcc index 57b071a..7fef4cb 100644 --- a/libstdc++-v3/include/tr1/random.tcc +++ b/libstdc++-v3/include/tr1/random.tcc @@ -298,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) for (int __k = 0; __k < (__n - __m); ++__k) { _UIntType __y = ((_M_x[__k] & __upper_mask) - |(_M_x[__k + 1] & __lower_mask)); + | (_M_x[__k + 1] & __lower_mask)); _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1) ^ ((__y & 0x01) ? __a : 0)); } @@ -311,6 +311,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) ^ ((__y & 0x01) ? __a : 0)); } + _UIntType __y = ((_M_x[__n - 1] & __upper_mask) + | (_M_x[0] & __lower_mask)); + _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1) + ^ ((__y & 0x01) ? __a : 0)); _M_p = 0; } |