Fix parsing half-floats on non-clang
This commit is contained in:
parent
1dc60011d7
commit
4def0b096d
1 changed files with 5 additions and 1 deletions
|
|
@ -57,7 +57,11 @@ template <typename T>
|
||||||
else
|
else
|
||||||
value = std::strtoull(str.data(), nullptr, 10);
|
value = std::strtoull(str.data(), nullptr, 10);
|
||||||
#else
|
#else
|
||||||
auto result = std::from_chars(str.data(), str.data() + str.size(), value);
|
std::from_chars_result result;
|
||||||
|
if constexpr (std::is_same_v<T, ::pslang::types::half_float>)
|
||||||
|
result = std::from_chars(str.data(), str.data() + str.size(), value.repr);
|
||||||
|
else
|
||||||
|
result = std::from_chars(str.data(), str.data() + str.size(), value);
|
||||||
if (result.ec != std::errc())
|
if (result.ec != std::errc())
|
||||||
throw std::system_error(std::make_error_code(result.ec));
|
throw std::system_error(std::make_error_code(result.ec));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue