Skip to content

Commit 30279ef

Browse files
pkucodemmsqe
andauthored
refactor: use the built-in max/min to simplify the code (#1777)
* refactor: use the built-in max/min to simplify the code Signed-off-by: pkucode <[email protected]> * lint --------- Signed-off-by: pkucode <[email protected]> Co-authored-by: mmsqe <[email protected]>
1 parent 399d33a commit 30279ef

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

memiavl/mem_node.go

Lines changed: 1 addition & 8 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

@@ -209,10 +209,3 @@ func EncodeBytes(w io.Writer, bz []byte) error {
209209
_, err := w.Write(bz)
210210
return err
211211
}
212-
213-
func maxUInt8(a, b uint8) uint8 {
214-
if a > b {
215-
return a
216-
}
217-
return b
218-
}

0 commit comments

Comments
 (0)