util/util.go
@@ -5,6 +5,7 @@ "errors" "net" "strconv" "unsafe" ) // 获取本机网卡IP @@ -70,3 +71,14 @@ } return c == len(arr) } func ByteSlice2float32Slice(src []byte) []float32 { if len(src) == 0 { return nil } l := len(src) / 4 ptr := unsafe.Pointer(&src[0]) return (*[1 << 26]float32)((*[1 << 26]float32)(ptr))[:l:l] }