You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

47 lines
534 B

package pixel
func abs(v int) int {
if v < 0 {
return -v
}
return v
}
func min(a, b int) int {
if a < b {
return a
}
return b
}
func max(a, b int) int {
if a > b {
return a
}
return b
}
func memset(b []byte, v byte) {
l := len(b)
if l == 0 {
return
}
b[0] = v
for i := 1; i < l; i <<= 1 {
copy(b[i:], b[:i])
}
}
func memsetSlice(b, v []byte) {
l := len(b)
i := copy(b, v)
for ; i < l; i <<= 1 {
copy(b[i:], b[:i])
}
}
func zeroRange(b []byte, n, l int) {
for i := n; i < l; i++ {
b[i] = 0
}
}