A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fmtlib/fmt/issues/4201 below:

fmt trunc fill character into 16bit, even for wchar_t(linux) or char32_t · Issue #4201 · fmtlib/fmt · GitHub

In UTF32, a code point is 4 bytes, but fmt only keeps 2 bytes when parsing it into fill:

template <typename Char> constexpr auto fill_unit() const -> Char { using uchar = unsigned char; return static_cast<Char>(static_cast<uchar>(fill_data_[0]) | (static_cast<uchar>(fill_data_[1]) << 8)); } FMT_CONSTEXPR void set_fill(char c) { fill_data_[0] = c; set_fill_size(1); } template <typename Char> FMT_CONSTEXPR void set_fill(basic_string_view<Char> s) { auto size = s.size(); set_fill_size(size); if (size == 1) { unsigned uchar = static_cast<detail::unsigned_char<Char>>(s[0]); fill_data_[0] = static_cast<char>(uchar); fill_data_[1] = static_cast<char>(uchar >> 8); return; } FMT_ASSERT(size <= max_fill_size, "invalid fill"); for (size_t i = 0; i < size; ++i) fill_data_[i & 3] = static_cast<char>(s[i]); } };

meanwhile, UTF8 can keep 4 bytes for fill.

repro: https://godbolt.org/z/qfTKe6W6c


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4