Skip to content

Commit 6c94f92

Browse files
committed
Update range naming
1 parent 5ab3e10 commit 6c94f92

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/normalize.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ const T_COUNT: u32 = 28;
7777
const N_COUNT: u32 = (V_COUNT * T_COUNT);
7878
const S_COUNT: u32 = (L_COUNT * N_COUNT);
7979

80-
const S_END: u32 = S_BASE + S_COUNT - 1;
81-
const L_END: u32 = L_BASE + L_COUNT - 1;
82-
const V_END: u32 = V_BASE + V_COUNT - 1;
83-
const T_END: u32 = T_BASE + T_COUNT - 1;
80+
const S_LAST: u32 = S_BASE + S_COUNT - 1;
81+
const L_LAST: u32 = L_BASE + L_COUNT - 1;
82+
const V_LAST: u32 = V_BASE + V_COUNT - 1;
83+
const T_LAST: u32 = T_BASE + T_COUNT - 1;
8484

8585
// 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;
86+
// i.e. `T_BASE + 1 ... T_LAST`.
87+
const T_FIRST: u32 = T_BASE + 1;
8888

8989
pub(crate) fn is_hangul_syllable(c: char) -> bool {
9090
(c as u32) >= S_BASE && (c as u32) < (S_BASE + S_COUNT)
@@ -123,15 +123,15 @@ fn compose_hangul(a: char, b: char) -> Option<char> {
123123
let (a, b) = (a as u32, b as u32);
124124
match (a, b) {
125125
// Compose a leading consonant and a vowel together into an LV_Syllable
126-
(L_BASE ... L_END, V_BASE ... V_END) => {
126+
(L_BASE ... L_LAST, V_BASE ... V_LAST) => {
127127
let l_index = a - L_BASE;
128128
let v_index = b - V_BASE;
129129
let lv_index = l_index * N_COUNT + v_index * T_COUNT;
130130
let s = S_BASE + lv_index;
131131
Some(unsafe {char::from_u32_unchecked(s)})
132132
},
133133
// Compose an LV_Syllable and a trailing consonant into an LVT_Syllable
134-
(S_BASE ... S_END, T_START ... T_END) if (a - S_BASE) % T_COUNT == 0 => {
134+
(S_BASE ... S_LAST, T_FIRST ... T_LAST) if (a - S_BASE) % T_COUNT == 0 => {
135135
Some(unsafe {char::from_u32_unchecked(a + (b - T_BASE))})
136136
},
137137
_ => None,
@@ -144,7 +144,7 @@ mod tests {
144144

145145
// Regression test from a bugfix where we were composing an LV_Syllable with
146146
// T_BASE directly. (We should only compose an LV_Syllable with a character
147-
// in the range `T_BASE + 1 ... T_END`.)
147+
// in the range `T_BASE + 1 ... T_LAST`.)
148148
#[test]
149149
fn test_hangul_composition() {
150150
assert_eq!(compose_hangul('\u{c8e0}', '\u{11a7}'), None);

0 commit comments

Comments
 (0)