Merge bitcoin/bitcoin#34396: fuzz: pull the latest FuzzedDataProvider.h from upstream

dfb9364609 fuzz: pull latest FuzzedDataProvider.h from upstream (b-l-u-e)

Pull request description:

  Pulls down the latest version of https://github.com/llvm/llvm-project/blob/main/compiler-rt/include/fuzzer/FuzzedDataProvider.h, after https://github.com/llvm/llvm-project/pull/177794 was merged upstream.

ACKs for top commit:
  fanquake:
    ACK dfb9364609 - updated the PR description.

Tree-SHA512: 36d003a1d92158537811d044bf4b79d63f0ec79e5b0da9e26a73a869c81578f9597ababcb79bb1949689db506c25341255c59979214ee28343fa08f85e2c3466
This commit is contained in:
merge-script
2026-02-02 09:55:46 +00:00

View File

@@ -314,7 +314,6 @@ T FuzzedDataProvider::PickValueInArray(const std::array<T, size> &array) {
template <typename T>
T FuzzedDataProvider::PickValueInArray(std::initializer_list<const T> list) {
// TODO(Dor1s): switch to static_assert once C++14 is allowed.
if (!list.size())
abort();
@@ -381,13 +380,13 @@ TS FuzzedDataProvider::ConvertUnsignedToSigned(TU value) {
static_assert(!std::numeric_limits<TU>::is_signed,
"Source type must be unsigned.");
// TODO(Dor1s): change to `if constexpr` once C++17 becomes mainstream.
if (std::numeric_limits<TS>::is_modulo)
if constexpr (std::numeric_limits<TS>::is_modulo)
return static_cast<TS>(value);
// Avoid using implementation-defined unsigned to signed conversions.
// To learn more, see https://stackoverflow.com/questions/13150449.
if (value <= std::numeric_limits<TS>::max()) {
constexpr auto TS_max = static_cast<TU>(std::numeric_limits<TS>::max());
if (value <= TS_max) {
return static_cast<TS>(value);
} else {
constexpr auto TS_min = std::numeric_limits<TS>::min();