*pc16 = ((c32 & 0xffc00) >> 10) | 0xd800; // https://issuetracker.google.com/289419882 // // We misread the spec when implementing this. The first call should return // the length of the decoded character, and the second call should return -3 // to indicate that the output is a continuation of the character decoded by // the first call. // // C23 7.30.1.3.4: // // between 1 and n inclusive if the next n or fewer bytes complete a valid // multibyte character (which is the value stored); the value returned is // the number of bytes that complete the multibyte character. // // (size_t)(-3) if the next character resulting from a previous call has // been stored (no bytes from the input have been consumed by this call). // // The first call returns the number of bytes consumed, and the second call // returns -3. // // All UTF-8 sequences that encode a surrogate pair are 4 bytes, but we may // not have seen the full sequence yet. return nconv;
}
if (mbspartialc16(state)) { return finish_surrogate(pc16, state);
}
char32_t c32;
size_t nconv = mbrtoc32(&c32, s, n, state); if (__MB_IS_ERR(nconv)) { return nconv;
} elseif (nconv == 0) { return mbstate_reset_and_return(nconv, state);
} elseif (c32 < 0x10000) {
*pc16 = static_cast<char16_t>(c32); return mbstate_reset_and_return(nconv, state);
} elseif (c32 > 0x10ffff) { // This case is currently handled by mbrtoc32() returning an error, but // if that function is extended to cover 5-byte sequences (which are // illegal at the moment), we'd need to explicitly handle the case of // codepoints that can't be represented as a surrogate pair here. return mbstate_reset_and_return_illegal(EILSEQ, state);
} else { return begin_surrogate(c32, pc16, nconv, state);
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.