mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-26 16:10:19 +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() {
|
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 {
|
func copyData(data []byte) []byte {
|
||||||
@ -101,9 +105,11 @@ func (yo *YOrder) Push(x interface{}) {
|
|||||||
yo.blocks = append(yo.blocks, x.(*Block))
|
yo.blocks = append(yo.blocks, x.(*Block))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (yo *YOrder) Pop() (x interface{}) {
|
func (yo *YOrder) Pop() interface{} {
|
||||||
l := len(yo.blocks)
|
blocks := yo.blocks
|
||||||
x = yo.blocks[l-1]
|
l := len(blocks)
|
||||||
yo.blocks = yo.blocks[0 : l-1]
|
x := blocks[l-1]
|
||||||
|
blocks[l-1] = nil
|
||||||
|
yo.blocks = blocks[:l-1]
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user