util/UTF8: fix indent

This commit is contained in:
Max Kellermann 2023-03-06 16:12:03 +01:00
parent 7a46c57ef3
commit 3b9aab0684
1 changed files with 31 additions and 31 deletions

View File

@ -272,38 +272,38 @@ Latin1ToUTF8(const char *gcc_restrict src, char *gcc_restrict buffer,
char *
UnicodeToUTF8(unsigned ch, char *q) noexcept
{
if (gcc_likely(ch < 0x80)) {
*q++ = (char)ch;
} else if (gcc_likely(ch < 0x800)) {
*q++ = MakeLeading1(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x10000) {
*q++ = MakeLeading2(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x200000) {
*q++ = MakeLeading3(ch >> 18);
*q++ = MakeContinuation(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x4000000) {
*q++ = MakeLeading4(ch >> 24);
*q++ = MakeContinuation(ch >> 18);
*q++ = MakeContinuation(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x80000000) {
*q++ = MakeLeading5(ch >> 30);
*q++ = MakeContinuation(ch >> 24);
*q++ = MakeContinuation(ch >> 18);
*q++ = MakeContinuation(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else {
// error
}
if (gcc_likely(ch < 0x80)) {
*q++ = (char)ch;
} else if (gcc_likely(ch < 0x800)) {
*q++ = MakeLeading1(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x10000) {
*q++ = MakeLeading2(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x200000) {
*q++ = MakeLeading3(ch >> 18);
*q++ = MakeContinuation(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x4000000) {
*q++ = MakeLeading4(ch >> 24);
*q++ = MakeContinuation(ch >> 18);
*q++ = MakeContinuation(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else if (ch < 0x80000000) {
*q++ = MakeLeading5(ch >> 30);
*q++ = MakeContinuation(ch >> 24);
*q++ = MakeContinuation(ch >> 18);
*q++ = MakeContinuation(ch >> 12);
*q++ = MakeContinuation(ch >> 6);
*q++ = MakeContinuation(ch);
} else {
// error
}
return q;
return q;
}
std::size_t