HomePhabricator

[libc++] Change requirements on linear_congruential_engine.

Authored by zoecarver on Nov 10 2020, 6:23 PM.

Description

[libc++] Change requirements on linear_congruential_engine.

This patch changes how linear_congruential_engine picks its randomization
algorithm. It adds two restrictions, _OverflowOK and _SchrageOK.
_OverflowOK means that m is a power of two so using the classic
(a * x + c) % m will create a meaningless overflow. The second checks
that Schrage's algorithm will produce results that are in bounds of min
and max. This patch fixes https://llvm.org/PR27839.

Differential Revision: D65041

Details

Committed
zoecarverNov 10 2020, 6:23 PM
Differential Revision
D65041: Change requirements on linear_congruential_engine
Parents
rG4eb8359e742b: [EarlyCSE] delete abs/nabs handling
Branches
Unknown
Tags
Unknown