fuzz: pull latest FuzzedDataProvider.h from upstream

This commit is contained in:
b-l-u-e
2026-01-24 01:29:58 +03:00
parent 705705e5b1
commit dfb9364609

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();