codec/h264/h264dec: made absi faster and more readable

This commit is contained in:
Saxon 2019-08-15 01:20:25 +09:30
parent a7abd76113
commit 08d3f6c3d1
1 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,6 @@ package h264dec
import (
"errors"
"math"
)
// binToSlice is a helper function to convert a string of binary into a
@ -57,6 +56,9 @@ func mini(a, b int) int {
return b
}
func absi(i int) int {
return int(math.Abs(float64(i)))
func absi(a int) int {
if a < 0 {
return -a
}
return a
}