[cfe-commits] [libcxx] r137617 - /libcxx/trunk/include/random

Howard Hinnant hhinnant at apple.com
Mon Aug 15 10:22:23 PDT 2011


Author: hhinnant
Date: Mon Aug 15 12:22:22 2011
New Revision: 137617

URL: http://llvm.org/viewvc/llvm-project?rev=137617&view=rev
Log:
Fix needle-in-haystack bug found by Walter Brown

Modified:
    libcxx/trunk/include/random

Modified: libcxx/trunk/include/random
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/random?rev=137617&r1=137616&r2=137617&view=diff
==============================================================================
--- libcxx/trunk/include/random (original)
+++ libcxx/trunk/include/random Mon Aug 15 12:22:22 2011
@@ -2562,8 +2562,11 @@
     linear_congruential_engine<result_type, 40014u, 0u, 2147483563u>
         __e(__sd == 0u ? default_seed : __sd);
     for (size_t __i = 0; __i < __r; ++__i)
+    {
+        result_type __e0 = __e();
         __x_[__i] = static_cast<result_type>(
-                                    (__e() + ((uint64_t)__e() << 32)) & _Max);
+                                    (__e0 + ((uint64_t)__e() << 32)) & _Max);
+    }
     __c_ = __x_[__r-1] == 0;
     __i_ = 0;
 }





More information about the cfe-commits mailing list