Skip to content

Commit 5ab3e10

Browse files
committed
Factor out T_START from match statement
1 parent bd3770c commit 5ab3e10

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/normalize.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ const L_END: u32 = L_BASE + L_COUNT - 1;
8282
const V_END: u32 = V_BASE + V_COUNT - 1;
8383
const T_END: u32 = T_BASE + T_COUNT - 1;
8484

85+
// Composition only occurs for `TPart`s in `U+11A8 ... U+11C2`,
86+
// i.e. `T_BASE + 1 ... T_END`.
87+
const T_START: u32 = T_BASE + 1;
88+
8589
pub(crate) fn is_hangul_syllable(c: char) -> bool {
8690
(c as u32) >= S_BASE && (c as u32) < (S_BASE + S_COUNT)
8791
}
@@ -127,7 +131,7 @@ fn compose_hangul(a: char, b: char) -> Option<char> {
127131
Some(unsafe {char::from_u32_unchecked(s)})
128132
},
129133
// Compose an LV_Syllable and a trailing consonant into an LVT_Syllable
130-
(S_BASE ... S_END, T_BASE ... T_END) if (a - S_BASE) % T_COUNT == 0 && (b - T_BASE) > 0 => {
134+
(S_BASE ... S_END, T_START ... T_END) if (a - S_BASE) % T_COUNT == 0 => {
131135
Some(unsafe {char::from_u32_unchecked(a + (b - T_BASE))})
132136
},
133137
_ => None,

0 commit comments

Comments
 (0)