mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-15 14:30:32 +02:00
Small cleanup. Moved min to common/math.
This commit is contained in:
@ -1,12 +1,19 @@
|
||||
package common
|
||||
|
||||
func max(a, b int) int {
|
||||
func Max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func Min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func max32(a, b int32) int32 {
|
||||
if a > b {
|
||||
return a
|
||||
|
@ -51,7 +51,7 @@ func (yo *YOrder) Reset() {
|
||||
|
||||
func copyData(data []byte) []byte {
|
||||
l := len(data)
|
||||
ndata := make([]byte, l, max(l, 8*1024))
|
||||
ndata := make([]byte, l, Max(l, 8*1024))
|
||||
copy(ndata, data)
|
||||
return ndata
|
||||
}
|
||||
@ -70,7 +70,7 @@ func (yo *YOrder) RenderBlock(block *Block, colors *Colors) (err error) {
|
||||
err = yo.Renderer.RenderBlock(oblock, colors)
|
||||
l := len(block.Data)
|
||||
if cap(oblock.Data) < l {
|
||||
oblock.Data = make([]byte, l, max(l, 8*1024))
|
||||
oblock.Data = make([]byte, l, Max(l, 8*1024))
|
||||
} else {
|
||||
oblock.Data = oblock.Data[0:l]
|
||||
}
|
||||
|
Reference in New Issue
Block a user