if (s == nullptr) { // Equivalent to c32rtomb(buf, U'\0', ps). return mbstate_reset_and_return(1, state);
}
// POSIX states that if char32_t is a null wide character, a null byte shall // be stored, preceded by any shift sequence needed to restore the initial // shift state. Since shift states are not supported, only the null byte is // stored. if (c32 == U'\0') {
*s = '\0'; return mbstate_reset_and_return(1, state);
}
if (!mbstate_is_initial(state)) { return mbstate_reset_and_return_illegal(EILSEQ, state);
}
if ((c32 & ~0x7f) == 0) { // Fast path for plain ASCII characters.
*s = c32; return1;
}
// Determine the number of octets needed to represent this character. // We always output the shortest sequence possible. Also specify the // first few bits of the first octet, which contains the information // about the sequence length.
uint8_t lead;
size_t length; // We already handled the 1-byte case above, so we go straight to 2-bytes... if ((c32 & ~0x7ff) == 0) {
lead = 0xc0;
length = 2;
} elseif ((c32 & ~0xffff) == 0) {
lead = 0xe0;
length = 3;
} elseif ((c32 & ~0x1fffff) == 0) {
lead = 0xf0;
length = 4;
} else {
errno = EILSEQ; return BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE;
}
// Output the octets representing the character in chunks // of 6 bits, least significant last. The first octet is // a special case because it contains the sequence length // information. for (size_t i = length - 1; i > 0; i--) {
s[i] = (c32 & 0x3f) | 0x80;
c32 >>= 6;
}
*s = (c32 & 0xff) | lead;
return length;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 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.