mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-24 16:40:22 +08:00
NewDisplayMatrixFromBytes should return a pointer
This commit is contained in:
@@ -11,13 +11,16 @@ import (
|
||||
|
||||
type DisplayMatrix [9]uint32
|
||||
|
||||
func NewDisplayMatrixFromBytes(b []byte) (m DisplayMatrix, err error) {
|
||||
func NewDisplayMatrixFromBytes(b []byte) (m *DisplayMatrix, err error) {
|
||||
// Check length
|
||||
if len(b) < 36 {
|
||||
err = fmt.Errorf("astiav: invalid length %d < 36", len(b))
|
||||
return
|
||||
}
|
||||
|
||||
// Create display matrix
|
||||
m = &DisplayMatrix{}
|
||||
|
||||
// Loop
|
||||
for idx := 0; idx < 9; idx++ {
|
||||
m[idx] = binary.BigEndian.Uint32(b[idx*4 : (idx+1)*4])
|
||||
|
||||
Reference in New Issue
Block a user