diff options
| author | Max Moroz <mmoroz@chromium.org> | 2019-08-08 19:49:37 +0000 |
|---|---|---|
| committer | Max Moroz <mmoroz@chromium.org> | 2019-08-08 19:49:37 +0000 |
| commit | df3b465c9c4fed5045470d3eb5b65c14e6de71e6 (patch) | |
| tree | 528a6cdb7323baa88acf92645cd2b94443ea3b5a /lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | |
| parent | d9cbd2acfa7d205788c43abdc66f6ee9680748ce (diff) | |
[compiler-rt] Add ConsumeProbability and ConsumeFloatingPoint methods to FDP.
Summary:
Also slightly cleaned up the comments and changed the header's extension
back to `.h` as per comments on https://reviews.llvm.org/D65812.
New methods added:
* `ConsumeProbability` returns [0.0, 1.0] by consuming an unsigned integer value
from the input data and dividing that value by the integer's max value.
* `ConsumeFloatingPointInRange` returns a floating point value in the given
range. Relies on `ConsumeProbability` method. This method does not have the
limitation of `std::uniform_real_distribution` that requires the given range
to be <= the floating point type's max. If the range is too large, this
implementation will additionally call `ConsumeBool` to decide whether the
result will be in the first or the second half of the range.
* `ConsumeFloatingPoint` returns a floating point value in the range
`[std::numeric_limits<T>::lowest(), std::numeric_limits<T>::min()]`.
Tested on Linux, Mac, Windows.
Reviewers: morehouse
Reviewed By: morehouse
Subscribers: kubamracek, mgorny, dberris, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D65905
llvm-svn: 368331
Diffstat (limited to 'lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp')
0 files changed, 0 insertions, 0 deletions
