mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Common: update json util function for converting to numeric value to use a static_cast. As discussed, a Saturating cast doesn't make sense when converting a double to a float
This commit is contained in:
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include <picojson.h>
|
#include <picojson.h>
|
||||||
|
|
||||||
#include "Common/MathUtil.h"
|
|
||||||
#include "Common/Matrix.h"
|
#include "Common/Matrix.h"
|
||||||
|
|
||||||
// Ideally this would use a concept like, 'template <std::ranges::range Range>' to constrain it,
|
// Ideally this would use a concept like, 'template <std::ranges::range Range>' to constrain it,
|
||||||
@ -47,7 +46,7 @@ std::optional<Type> ReadNumericFromJson(const picojson::object& obj, const std::
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
if (!it->second.is<double>())
|
if (!it->second.is<double>())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
return MathUtil::SaturatingCast<Type>(it->second.get<double>());
|
return static_cast<Type>(it->second.get<double>());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> ReadStringFromJson(const picojson::object& obj, const std::string& key);
|
std::optional<std::string> ReadStringFromJson(const picojson::object& obj, const std::string& key);
|
||||||
|
Reference in New Issue
Block a user