-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathnode.go
More file actions
23 lines (19 loc) · 744 Bytes
/
Copy pathnode.go
File metadata and controls
23 lines (19 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package art
// prefix used in the node to store the key prefix.
// it is used to improve leaf key comparison performance.
type prefix [maxPrefixLen]byte
// node is the base struct for all node types.
// it contains the common fields for all nodeX types.
type node struct {
prefix prefix // prefix of the node
prefixLen uint16 // length of the prefix
childrenLen uint16 // number of children in the node4, node16, node48, node256
}
// replaceRef is used to replace node in-place by updating the reference.
func replaceRef(oldNode **nodeRef, newNode *nodeRef) {
*oldNode = newNode
}
// replaceNode is used to replace node in-place by updating the node.
func replaceNode(oldNode *nodeRef, newNode *nodeRef) {
*oldNode = *newNode
}