Skip to content

Commit 14d0a93

Browse files
committed
refactor: use the built-in max/min to simplify the code
Signed-off-by: pkucode <[email protected]>
1 parent 80ed68b commit 14d0a93

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

memiavl/mem_node.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (node *MemNode) Hash() []byte {
8888
}
8989

9090
func (node *MemNode) updateHeightSize() {
91-
node.height = maxUInt8(node.left.Height(), node.right.Height()) + 1
91+
node.height = max(node.left.Height(), node.right.Height()) + 1
9292
node.size = node.left.Size() + node.right.Size()
9393
}
9494

@@ -210,9 +210,3 @@ func EncodeBytes(w io.Writer, bz []byte) error {
210210
return err
211211
}
212212

213-
func maxUInt8(a, b uint8) uint8 {
214-
if a > b {
215-
return a
216-
}
217-
return b
218-
}

0 commit comments

Comments
 (0)