mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-06 08:15:00 -06:00
fix float parsing (#3896)
This commit is contained in:
parent
256397aa3b
commit
55e2b0f520
@ -51,14 +51,14 @@ std::string convertValueToHex(const std::string type, const std::string valueStr
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
} floatUnion;
|
} floatUnion;
|
||||||
floatUnion.f = std::stof(valueStr);
|
floatUnion.f = std::stof(valueStr);
|
||||||
result = toHex(floatUnion.i, sizeof(floatUnion.i));
|
result = toHex(std::byteswap(floatUnion.i), sizeof(floatUnion.i));
|
||||||
} else if (type == "float64") {
|
} else if (type == "float64") {
|
||||||
union {
|
union {
|
||||||
double d;
|
double d;
|
||||||
uint64_t i;
|
uint64_t i;
|
||||||
} doubleUnion;
|
} doubleUnion;
|
||||||
doubleUnion.d = std::stod(valueStr);
|
doubleUnion.d = std::stod(valueStr);
|
||||||
result = toHex(doubleUnion.i, sizeof(doubleUnion.i));
|
result = toHex(std::byteswap(doubleUnion.i), sizeof(doubleUnion.i));
|
||||||
} else if (type == "utf8") {
|
} else if (type == "utf8") {
|
||||||
std::vector<unsigned char> byteArray =
|
std::vector<unsigned char> byteArray =
|
||||||
std::vector<unsigned char>(valueStr.begin(), valueStr.end());
|
std::vector<unsigned char>(valueStr.begin(), valueStr.end());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user