mirror of
https://github.com/openharmony/third_party_rust_unicode-normalization.git
synced 2026-07-19 15:03:34 -04:00
Factor out T_START from match statement
This commit is contained in:
+5
-1
@@ -82,6 +82,10 @@ const L_END: u32 = L_BASE + L_COUNT - 1;
|
||||
const V_END: u32 = V_BASE + V_COUNT - 1;
|
||||
const T_END: u32 = T_BASE + T_COUNT - 1;
|
||||
|
||||
// Composition only occurs for `TPart`s in `U+11A8 ... U+11C2`,
|
||||
// i.e. `T_BASE + 1 ... T_END`.
|
||||
const T_START: u32 = T_BASE + 1;
|
||||
|
||||
pub(crate) fn is_hangul_syllable(c: char) -> bool {
|
||||
(c as u32) >= S_BASE && (c as u32) < (S_BASE + S_COUNT)
|
||||
}
|
||||
@@ -127,7 +131,7 @@ fn compose_hangul(a: char, b: char) -> Option<char> {
|
||||
Some(unsafe {char::from_u32_unchecked(s)})
|
||||
},
|
||||
// Compose an LV_Syllable and a trailing consonant into an LVT_Syllable
|
||||
(S_BASE ... S_END, T_BASE ... T_END) if (a - S_BASE) % T_COUNT == 0 && (b - T_BASE) > 0 => {
|
||||
(S_BASE ... S_END, T_START ... T_END) if (a - S_BASE) % T_COUNT == 0 => {
|
||||
Some(unsafe {char::from_u32_unchecked(a + (b - T_BASE))})
|
||||
},
|
||||
_ => None,
|
||||
|
||||
Reference in New Issue
Block a user