Skip to content

Commit

Permalink
Fix Trie tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsanbarkati committed Nov 7, 2020
1 parent d76aae9 commit 692e2d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xidmap/trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ type Trie struct {
func NewTrie() *Trie {
buf, err := z.NewBufferWith(32<<20, math.MaxUint32, z.UseMmap)
x.Check(err)
ro := buf.AllocateOffset(nodeSz)
// Add additional 8 bytes at the start, because offset=0 is used for checking non-existing node.
// Therefore we can't keep root at 0 offset.
ro := buf.AllocateOffset(nodeSz + 8)
return &Trie{
root: uint32(ro),
root: uint32(ro + 8),
buf: buf,
}
}
Expand Down

0 comments on commit 692e2d7

Please sign in to comment.