File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,10 +14,11 @@ const (
1414// encodeHeader creates the encoded header for the branch.
1515func (b * Branch ) encodeHeader (writer io.Writer ) (err error ) {
1616 var header byte
17+ const nodeHeaderShift = 6
1718 if b .Value == nil {
18- header = byte (BranchType ) << 6
19+ header = byte (BranchType ) << nodeHeaderShift
1920 } else {
20- header = byte (BranchWithValueType ) << 6
21+ header = byte (BranchWithValueType ) << nodeHeaderShift
2122 }
2223
2324 if len (b .Key ) >= keyLenOffset {
@@ -44,7 +45,8 @@ func (b *Branch) encodeHeader(writer io.Writer) (err error) {
4445
4546// encodeHeader creates the encoded header for the leaf.
4647func (l * Leaf ) encodeHeader (writer io.Writer ) (err error ) {
47- header := byte (LeafType ) << 6
48+ const nodeHeaderShift = 6
49+ header := byte (LeafType ) << nodeHeaderShift
4850
4951 if len (l .Key ) < 63 {
5052 header |= byte (len (l .Key ))
You can’t perform that action at this time.
0 commit comments