Skip to content

Commit 8da04a1

Browse files
authored
Next (#1158)
* move print_freestanding to impl.h * impl * [print] move print_freestanding to a seperate directory to revamp it * special * add license and license-zhCN.txt for anti-tivoization * [core] Fix warnings for codecvt for clang for charxx_t
1 parent 82288e6 commit 8da04a1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/fast_io_core_impl/codecvt/general.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ general_code_cvt(src_char_type const *src_first, src_char_type const *src_last,
184184
}
185185
else
186186
{
187-
dst += get_utf_code_units<encoding>(code, dst);
187+
dst += get_utf_code_units<encoding>(static_cast<char32_t>(code), dst);
188188
}
189189
}
190190
}
@@ -278,7 +278,7 @@ general_code_cvt(src_char_type const *src_first, src_char_type const *src_last,
278278
}
279279
else
280280
{
281-
*dst = static_cast<char8_t>(*src_first);
281+
*dst = static_cast<dest_char_type>(static_cast<char8_t>(*src_first));
282282
}
283283
if constexpr (sizeof(dest_char_type) != 1 && encoding_is_utf(encoding) &&
284284
!is_native_scheme(encoding))

include/fast_io_core_impl/literals/literal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,21 @@ inline constexpr char_type char_literal_add(T offs) noexcept
8686
}
8787
#endif
8888
using unsigned_char_type = ::std::make_unsigned_t<char_type>;
89-
using unsigned_result_type =
90-
::std::make_unsigned_t<::std::remove_cvref_t<decltype(arithmetic_char_literal_v<ch, char_type> + offs)>>;
89+
using common_chtype = ::std::common_type_t<char_type, decltype(ch)>;
90+
using unsigned_result_type = ::std::make_unsigned_t<::std::remove_cvref_t<decltype(static_cast<common_chtype>(arithmetic_char_literal_v<ch, char_type>) + offs)>>;
9191
if constexpr (::std::same_as<char_type, wchar_t> && ::fast_io::details::wide_is_none_utf_endian)
9292
{
9393
static_assert(::std::numeric_limits<::std::uint_least8_t>::digits <= ::std::numeric_limits<wchar_t>::digits);
9494
constexpr unsigned leftshift_offset{static_cast<unsigned>(::std::numeric_limits<wchar_t>::digits -
9595
::std::numeric_limits<::std::uint_least8_t>::digits)};
9696
return static_cast<char_type>(static_cast<unsigned_char_type>(static_cast<unsigned_result_type>(
97-
arithmetic_char_literal_v<ch, char_type> + offs))
97+
static_cast<common_chtype>(arithmetic_char_literal_v<ch, char_type>) + offs))
9898
<< leftshift_offset);
9999
}
100100
else
101101
{
102102
return static_cast<char_type>(static_cast<unsigned_char_type>(
103-
static_cast<unsigned_result_type>(arithmetic_char_literal_v<ch, char_type> + offs)));
103+
static_cast<unsigned_result_type>(static_cast<common_chtype>(arithmetic_char_literal_v<ch, char_type>) + offs)));
104104
}
105105
}
106106

0 commit comments

Comments
 (0)