]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/unicode-table-generator/src/range_search.rs
Remove separate encoding for a single nonzero-mapping byte
[rust.git] / src / tools / unicode-table-generator / src / range_search.rs
index 49e65521c9846e3a7acc2309a55762b186c86921..39b47ce703f37b07f807eecd8f60dd3e8c4ac637 100644 (file)
@@ -8,7 +8,6 @@ fn bitset_search<
 >(
     needle: u32,
     chunk_idx_map: &[u8; N],
-    last_chunk_idx: u16,
     bitset_chunk_idx: &[[u8; CHUNK_SIZE]; N1],
     bitset_canonical: &[u64; CANONICAL],
     bitset_canonicalized: &[(u8, u8); CANONICALIZED],
@@ -16,12 +15,8 @@ fn bitset_search<
     let bucket_idx = (needle / 64) as usize;
     let chunk_map_idx = bucket_idx / CHUNK_SIZE;
     let chunk_piece = bucket_idx % CHUNK_SIZE;
-    // The last entry of `chunk_idx_map` actually should be at `last_chunk_idx`,
-    // so we need to remap it
-    let chunk_idx = if chunk_map_idx < (chunk_idx_map.len() - 1) {
-        chunk_idx_map[chunk_map_idx]
-    } else if chunk_map_idx == last_chunk_idx as usize {
-        chunk_idx_map[chunk_idx_map.len() - 1]
+    let chunk_idx = if let Some(&v) = chunk_idx_map.get(chunk_map_idx) {
+        v
     } else {
         return false;
     };