[PATCH] D50736: [libc++] Use correct rand.eng.mers all-zeroes seed sequence fallback

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 14 13:53:39 PDT 2018


hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: mclow.lists, EricWF, jasonliu.
Herald added subscribers: ldionne, christof.

When a seed sequence would lead to having no non-zero significant bits in the initial state of a `mersenne_twister_engine`, the fallback is to flip the most significant bit of the first value that appears in the textual representation of the initial state.

rand.eng.mers describes this as setting the value to be 2 to the power of one less than w; the previous value encoded in the implementation, namely one less than "2 to the power of w", is replaced by the correct value in this patch.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50736

Files:
  include/random
  test/libcxx/numerics/rand/rand.eng.mers/
  test/libcxx/numerics/rand/rand.eng.mers/cnstr_sseq_all_zero.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50736.160687.patch
Type: text/x-patch
Size: 3070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180814/5d29e7de/attachment.bin>


More information about the cfe-commits mailing list