diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-18 23:42:07 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-18 23:42:07 +0100 |
commit | 4d9a82b720c8ce74b94f43f72ddd819ef21abbdf (patch) | |
tree | c0a5d21b8e19fbb60c286faec8e302e6f32b6679 /serialize/magnum-vector2i.hpp | |
parent | 32b8c22828315292857e2cd9909fba620f30ff70 (diff) |
pre-declare integer types without cstddef/cstdint
Diffstat (limited to 'serialize/magnum-vector2i.hpp')
-rw-r--r-- | serialize/magnum-vector2i.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/serialize/magnum-vector2i.hpp b/serialize/magnum-vector2i.hpp index f63bd130..aa2c3939 100644 --- a/serialize/magnum-vector2i.hpp +++ b/serialize/magnum-vector2i.hpp @@ -14,7 +14,7 @@ struct adl_serializer<Magnum::Math::Vector2<t>> final static void to_json(json& j, const Magnum::Math::Vector2<t>& val) { char buf[64]; - using type = std::conditional_t<std::is_signed_v<t>, std::intmax_t, std::uintmax_t>; + using type = std::conditional_t<std::is_signed_v<t>, intmax_t, uintmax_t>; constexpr auto format_string = std::is_signed_v<t> ? "%jd x %jd" : "%ju x %ju"; snprintf(buf, sizeof(buf), format_string, (type)val[0], (type)val[1]); j = buf; @@ -23,12 +23,12 @@ struct adl_serializer<Magnum::Math::Vector2<t>> final { using namespace floormat; std::string str = j; - using type = std::conditional_t<std::is_signed_v<t>, std::intmax_t, std::uintmax_t>; + using type = std::conditional_t<std::is_signed_v<t>, intmax_t, uintmax_t>; constexpr auto format_string = std::is_signed_v<t> ? "%jd x %jd%n" : "%ju x %ju%n"; type x = 0, y = 0; int n = 0; int ret = std::sscanf(str.data(), format_string, &x, &y, &n); - if (ret != 2 || (std::size_t)n != str.size() || x != (t)x || y != (t)y) + if (ret != 2 || (size_t)n != str.size() || x != (t)x || y != (t)y) fm_throw("failed to parse Vector2 '{}'"_cf, str); val = { (t)x, (t)y }; } |