This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Fix thinko in recent changes to linear_congruential_engine<>::seed


HI,

tested x86_64-linux, committed to mainline.

Paolo.

//////////////////
2009-04-06  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/random.tcc (linear_congruential_engine<>::
	seed(seed_seq&)): Fix typo in last fix for __m == 0.
Index: include/bits/random.tcc
===================================================================
--- include/bits/random.tcc	(revision 145601)
+++ include/bits/random.tcc	(working copy)
@@ -119,8 +119,8 @@
     seed(seed_seq& __q)
     {
       const _UIntType __k0 = __m == 0 ? std::numeric_limits<_UIntType>::digits
-	                              : (std::__lg(__m) + 31);
-      const _UIntType __k = __k0 / 32;
+	                              : std::__lg(__m);
+      const _UIntType __k = (__k0 + 31) / 32;
       _UIntType __arr[__k + 3];
       __q.generate(__arr + 0, __arr + 3);
       _UIntType __factor = 1U;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]