/** *DataandfunctionsfortheFCDcheckfastpath. * *Thefastpathlooksatapairof16-bitcodeunitsandchecks *whetherthereisanFCDboundarybetweenthem; *thereisifthefirstunithasatrailingccc=0(!hasTccc(first)) *orthesecondunithasaleadingccc=0(!hasLccc(second)), *orboth. *Whenthefastpathfindsapossiblenon-boundary, *thentheFCDcheckslowpathlooksattheactualsequenceofFCDvalues. * *Thisisapureoptimization. *Thefastpathmustatleastfindallpossiblenon-boundaries. *Ifthefastpathistoopessimistic,itcostsperformance. * *ForapairofBMPcharacters,thefastpathtestsareprecise(1bitpercharacter). * *Forasupplementarycodepoint,thetwounitsareitsleadandtrailsurrogates. *WesethasTccc(lead)=trueifanyofits1024associatedsupplementarycodepoints *haslccc!=0ortccc!=0. *WesethasLccc(trail)=trueforalltrailsurrogates. *Asaresult,weleavethefastpathiftheleadsurrogatemightstarta *supplementarycodepointthatisnotFCD-inert. *(Sothefastpathneednotdetectthatthereisasurrogatepair, *norlookaheadtothenextfullcodepoint.) * *hasLccc(lead)=trueifanyofits1024associatedsupplementarycodepoints *haslccc!=0,forfastboundarycheckingbetweenBMP&supplementary. * *hasTccc(trail)=false: *ItshouldonlybetestedforunpairedtrailsurrogateswhichareFCD-inert.
*/ class U_I18N_API CollationFCD {
public: staticinline UBool hasLccc(UChar32 c) { // assert c <= 0xffff // c can be negative, e.g., U_SENTINEL from UCharIterator; // that is handled in the first test.
int32_t i; return // U+0300 is the first character with lccc!=0.
c >= 0x300 &&
(i = lcccIndex[c >> 5]) != 0 &&
(lcccBits[i] & (static_cast<uint32_t>(1) << (c & 0x1f))) != 0;
}
staticinline UBool hasTccc(UChar32 c) { // assert c <= 0xffff // c can be negative, e.g., U_SENTINEL from UCharIterator; // that is handled in the first test.
int32_t i; return // U+00C0 is the first character with tccc!=0.
c >= 0xc0 &&
(i = tcccIndex[c >> 5]) != 0 &&
(tcccBits[i] & (static_cast<uint32_t>(1) << (c & 0x1f))) != 0;
}
staticinline UBool mayHaveLccc(UChar32 c) { // Handles all of Unicode 0..10FFFF. // c can be negative, e.g., U_SENTINEL. // U+0300 is the first character with lccc!=0. if(c < 0x300) { returnfalse; } if(c > 0xffff) { c = U16_LEAD(c); }
int32_t i; return
(i = lcccIndex[c >> 5]) != 0 &&
(lcccBits[i] & (static_cast<uint32_t>(1) << (c & 0x1f))) != 0;
}
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.