re PR libstdc++/50509 ([C++0x] incorrect code in std::seed_seq::generate)
authorJohn Salmon <john.salmon@deshaw.com>
Sat, 24 Sep 2011 18:28:36 +0000 (18:28 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 24 Sep 2011 18:28:36 +0000 (18:28 +0000)
2011-09-24  John Salmon  <john.salmon@deshaw.com>

PR libstdc++/50509
* include/bits/random.tcc (seed_seq::generate): Fix computation.

From-SVN: r179144

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.tcc

index b0b433e3190c8c104550850020f22ceb865a2800..67643de3ef62389807b3431b223660ead69e2608 100644 (file)
@@ -1,3 +1,8 @@
+2011-09-24  John Salmon  <john.salmon@deshaw.com>
+
+       PR libstdc++/50509
+       * include/bits/random.tcc (seed_seq::generate): Fix computation.
+
 2011-09-21  Benjamin Kosnik  <bkoz@redhat.com
 
        * doc/Makefile.am (stamp-epub-docbook): Fix image directory location.
index 01ee5824cd9f7df64c564e0910d285f749c53f73..d35f2f4cf9a48b9a61f777f5ea04ea50929b8841 100644 (file)
@@ -2768,7 +2768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          _Type __arg = (__begin[__k % __n]
                         ^ __begin[(__k + __p) % __n]
                         ^ __begin[(__k - 1) % __n]);
-         _Type __r1 = __arg ^ (__arg << 27);
+         _Type __r1 = __arg ^ (__arg >> 27);
          __r1 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value,
                                 1664525u, 0u>(__r1);
          _Type __r2 = __r1;
@@ -2790,7 +2790,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          _Type __arg = (__begin[__k % __n]
                         + __begin[(__k + __p) % __n]
                         + __begin[(__k - 1) % __n]);
-         _Type __r3 = __arg ^ (__arg << 27);
+         _Type __r3 = __arg ^ (__arg >> 27);
          __r3 = __detail::__mod<_Type, __detail::_Shift<_Type, 32>::__value,
                                 1566083941u, 0u>(__r3);
          _Type __r4 = __r3 - __k % __n;