simplify Pop function in nonceHeap

This commit is contained in:
maskpp 2024-06-28 21:18:52 +08:00
parent 045b9718d5
commit 72f23710ba

View file

@ -44,11 +44,8 @@ func (h *nonceHeap) Push(x interface{}) {
}
func (h *nonceHeap) Pop() interface{} {
old := *h
n := len(old)
x := old[n-1]
old[n-1] = 0
*h = old[0 : n-1]
var x interface{}
x, *h = (*h)[len(*h)-1], (*h)[:len(*h)-1]
return x
}