Skip to content

Commit 52dfa01

Browse files
committed
fix Wsign-conversion
1 parent fabaaaf commit 52dfa01

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/mgutility/chrono/parse.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ constexpr int32_t abs(int32_t value) noexcept {
8484
}
8585

8686
// NOLINTNEXTLINE
87-
constexpr auto pow(int32_t base, int32_t exp) noexcept -> int32_t {
87+
template <typename T> constexpr auto pow(T base, T exp) noexcept -> T {
8888
// NOLINTNEXTLINE
8989
return exp < 0 ? 0 : exp == 0 ? 1 : base * pow(base, exp - 1);
9090
}
@@ -327,7 +327,7 @@ MGUTILITY_CNSTXPR auto parse_second(detail::tm &result, string_view date_str,
327327

328328
MGUTILITY_CNSTXPR auto parse_fraction(detail::tm &result, string_view date_str,
329329
uint32_t &next) -> std::errc {
330-
int32_t digits = 0;
330+
uint32_t digits = 0;
331331
while (next + digits < date_str.size() &&
332332
mgutility::detail::is_digit(date_str[next + digits]) && digits < 9) {
333333
++digits;
@@ -336,7 +336,7 @@ MGUTILITY_CNSTXPR auto parse_fraction(detail::tm &result, string_view date_str,
336336
if (error != std::errc{}) {
337337
return error;
338338
}
339-
result.tm_ms *= static_cast<uint32_t>(pow(10, 9 - digits));
339+
result.tm_ms *= pow<uint32_t>(10, 9 - digits);
340340
error = check_range(result.tm_ms, 0U, 999999999U);
341341
return error;
342342
}

0 commit comments

Comments
 (0)