|
10 | 10 | // Lowercase : 943 bytes, 2569 codepoints in 676 ranges (U+0000AA - U+01E944) using bitset |
11 | 11 | // Lt : 33 bytes, 31 codepoints in 10 ranges (U+0001C5 - U+001FFD) using skiplist |
12 | 12 | // N : 463 bytes, 1914 codepoints in 145 ranges (U+0000B2 - U+01FBFA) using skiplist |
| 13 | +// NFC_QC_Maybe : 155 bytes, 132 codepoints in 49 ranges (U+000300 - U+016D69) using skiplist |
13 | 14 | // Uppercase : 799 bytes, 1980 codepoints in 659 ranges (U+0000C0 - U+01F18A) using bitset |
14 | 15 | // White_Space : 256 bytes, 19 codepoints in 8 ranges (U+000085 - U+003001) using cascading |
15 | 16 | // to_lower : 1112 bytes, 1462 codepoints in 185 ranges (U+0000C0 - U+01E921) using 2-level LUT |
16 | 17 | // to_upper : 1998 bytes, 1554 codepoints in 299 ranges (U+0000B5 - U+01E943) using 2-level LUT |
17 | 18 | // to_title : 340 bytes, 135 codepoints in 49 ranges (U+0000DF - U+00FB17) using 2-level LUT |
18 | 19 | // to_casefold : 32 bytes, 174 codepoints in 5 ranges (U+000131 - U+00ABBF) using 2-level LUT |
19 | | -// Total : 11756 bytes |
| 20 | +// Total : 11911 bytes |
20 | 21 |
|
21 | 22 | #[inline(always)] |
22 | 23 | const fn bitset_search< |
@@ -889,6 +890,47 @@ pub mod n { |
889 | 890 | } |
890 | 891 | } |
891 | 892 |
|
| 893 | +#[rustfmt::skip] |
| 894 | +pub mod nfc_qc_maybe { |
| 895 | + use super::ShortOffsetRunHeader; |
| 896 | + |
| 897 | + static SHORT_OFFSET_RUNS: [ShortOffsetRunHeader; 14] = [ |
| 898 | + ShortOffsetRunHeader::new(0, 768), ShortOffsetRunHeader::new(1, 1619), |
| 899 | + ShortOffsetRunHeader::new(25, 2364), ShortOffsetRunHeader::new(27, 2878), |
| 900 | + ShortOffsetRunHeader::new(33, 4142), ShortOffsetRunHeader::new(57, 4449), |
| 901 | + ShortOffsetRunHeader::new(59, 6965), ShortOffsetRunHeader::new(63, 12441), |
| 902 | + ShortOffsetRunHeader::new(65, 69818), ShortOffsetRunHeader::new(67, 70462), |
| 903 | + ShortOffsetRunHeader::new(71, 71984), ShortOffsetRunHeader::new(93, 90398), |
| 904 | + ShortOffsetRunHeader::new(95, 93543), ShortOffsetRunHeader::new(97, 1207657), |
| 905 | + ]; |
| 906 | + static OFFSETS: [u8; 99] = [ |
| 907 | + 0, 5, 1, 7, 2, 1, 1, 1, 1, 2, 6, 1, 7, 6, 4, 2, 1, 2, 6, 1, 9, 1, 2, 1, 0, 3, 0, 1, 129, 1, |
| 908 | + 24, 1, 0, 1, 23, 2, 102, 1, 24, 1, 126, 1, 107, 1, 18, 2, 103, 1, 24, 1, 114, 1, 4, 1, 15, |
| 909 | + 1, 0, 1, 0, 21, 50, 27, 0, 1, 0, 2, 0, 1, 108, 1, 0, 1, 24, 1, 96, 1, 2, 1, 6, 1, 2, 1, 1, |
| 910 | + 3, 230, 1, 9, 1, 2, 1, 241, 1, 0, 1, 0, 12, 0, 2, 0, |
| 911 | + ]; |
| 912 | + #[inline] |
| 913 | + pub fn lookup(c: char) -> bool { |
| 914 | + debug_assert!(!c.is_ascii()); |
| 915 | + (c as u32) >= 0x300 && lookup_slow(c) |
| 916 | + } |
| 917 | + |
| 918 | + #[inline(never)] |
| 919 | + fn lookup_slow(c: char) -> bool { |
| 920 | + const { |
| 921 | + assert!(SHORT_OFFSET_RUNS.last().unwrap().0 > char::MAX as u32); |
| 922 | + let mut i = 0; |
| 923 | + while i < SHORT_OFFSET_RUNS.len() { |
| 924 | + assert!(SHORT_OFFSET_RUNS[i].start_index() < OFFSETS.len()); |
| 925 | + i += 1; |
| 926 | + } |
| 927 | + } |
| 928 | + // SAFETY: We just ensured the last element of `SHORT_OFFSET_RUNS` is greater than `std::char::MAX` |
| 929 | + // and the start indices of all elements in `SHORT_OFFSET_RUNS` are smaller than `OFFSETS.len()`. |
| 930 | + unsafe { super::skip_search(c, &SHORT_OFFSET_RUNS, &OFFSETS) } |
| 931 | + } |
| 932 | +} |
| 933 | + |
892 | 934 | #[rustfmt::skip] |
893 | 935 | pub mod uppercase { |
894 | 936 | static BITSET_CHUNKS_MAP: [u8; 125] = [ |
|
0 commit comments