Skip to content

Commit

Permalink
Simplify fuzzy rune existance compare
Browse files Browse the repository at this point in the history
  • Loading branch information
derekparker committed Feb 19, 2015
1 parent b7e7825 commit 5c920bd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,20 @@ func collect(node *Node, pre []rune, keys *[]string) {
}

func fuzzycollect(node *Node, partialmatch, partial []rune, keys *[]string) {
partiallen := len(partial)
var (
m uint64
partiallen = len(partial)
)

if partiallen == 0 {
collect(node, partialmatch, keys)
return
}

m := maskruneslice(partial)
children := node.Children()
m = maskruneslice(partial)
for v, n := range children {
xor := n.Mask() ^ m
if (xor & m) != 0 {
if (n.mask & m) != m {
continue
}

Expand Down

0 comments on commit 5c920bd

Please sign in to comment.