mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-13 05:40:20 +01:00
Small clean up in y order code.
This commit is contained in:
parent
427ec305fc
commit
4a3fa1f568
|
@ -36,7 +36,11 @@ func NewYOrder(renderFn func(*Block) error, capacity int) *YOrder {
|
|||
}
|
||||
|
||||
func (yo *YOrder) Reset() {
|
||||
yo.blocks = yo.blocks[:0]
|
||||
blocks := yo.blocks
|
||||
for i := range blocks {
|
||||
blocks[i] = nil
|
||||
}
|
||||
yo.blocks = blocks[:0]
|
||||
}
|
||||
|
||||
func copyData(data []byte) []byte {
|
||||
|
@ -101,9 +105,11 @@ func (yo *YOrder) Push(x interface{}) {
|
|||
yo.blocks = append(yo.blocks, x.(*Block))
|
||||
}
|
||||
|
||||
func (yo *YOrder) Pop() (x interface{}) {
|
||||
l := len(yo.blocks)
|
||||
x = yo.blocks[l-1]
|
||||
yo.blocks = yo.blocks[0 : l-1]
|
||||
func (yo *YOrder) Pop() interface{} {
|
||||
blocks := yo.blocks
|
||||
l := len(blocks)
|
||||
x := blocks[l-1]
|
||||
blocks[l-1] = nil
|
||||
yo.blocks = blocks[:l-1]
|
||||
return x
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user