github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/gio/internal/ops/ops.go (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 package ops 4 5 import ( 6 "encoding/binary" 7 "math" 8 9 "github.com/gop9/olt/gio/f32" 10 "github.com/gop9/olt/gio/internal/opconst" 11 "github.com/gop9/olt/gio/op" 12 ) 13 14 func DecodeTransformOp(d []byte) op.TransformOp { 15 bo := binary.LittleEndian 16 if opconst.OpType(d[0]) != opconst.TypeTransform { 17 panic("invalid op") 18 } 19 return op.TransformOp{}.Offset(f32.Point{ 20 X: math.Float32frombits(bo.Uint32(d[1:])), 21 Y: math.Float32frombits(bo.Uint32(d[5:])), 22 }) 23 }