Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Efficient trie lookup for boolean Unicode properties #33098

Merged
merged 3 commits into from
May 23, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix wrong shift in trie_lookup_range_table
Somehow got in my head that >> 8 was the right shift for a chunk of 64.
Oops, sorry.
  • Loading branch information
raphlinus committed Apr 19, 2016
commit 6923bc5fc73ce924228443c93420544e2853ed77
2 changes: 1 addition & 1 deletion src/etc/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def emit_trie_lookup_range_table(f):
fn trie_lookup_range_table(c: char, r: &'static BoolTrie) -> bool {
let c = c as usize;
if c < 0x800 {
trie_range_leaf(c, r.r1[c >> 8])
trie_range_leaf(c, r.r1[c >> 6])
} else if c < 0x10000 {
let child = r.r2[c >> 6];
trie_range_leaf(c, r.r3[child as usize])
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_unicode/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn trie_range_leaf(c: usize, bitmap_chunk: u64) -> bool {
fn trie_lookup_range_table(c: char, r: &'static BoolTrie) -> bool {
let c = c as usize;
if c < 0x800 {
trie_range_leaf(c, r.r1[c >> 8])
trie_range_leaf(c, r.r1[c >> 6])
} else if c < 0x10000 {
let child = r.r2[c >> 6];
trie_range_leaf(c, r.r3[child as usize])
Expand Down