summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2011-08-15 17:22:22 +0000
committerHoward Hinnant <hhinnant@apple.com>2011-08-15 17:22:22 +0000
commit052fd9349f9b4f9421cfcf9a2d0b42cb74db932d (patch)
tree45e79d1bf68fb228b3fcc76d5f17bbf2d6de0ee7 /libcxx
parent30694dcdebd232e69a079b3728c16d3e51c124e6 (diff)
downloadbcm5719-llvm-052fd9349f9b4f9421cfcf9a2d0b42cb74db932d.tar.gz
bcm5719-llvm-052fd9349f9b4f9421cfcf9a2d0b42cb74db932d.zip
Fix needle-in-haystack bug found by Walter Brown
llvm-svn: 137617
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/random5
1 files changed, 4 insertions, 1 deletions
diff --git a/libcxx/include/random b/libcxx/include/random
index ac7b04dbc07..0e0860e7398 100644
--- a/libcxx/include/random
+++ b/libcxx/include/random
@@ -2562,8 +2562,11 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::seed(result_type __sd,
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;
}
OpenPOWER on IntegriCloud