24 lines
470 B
Go
24 lines
470 B
Go
//go:build cgo
|
|
|
|
package packetizer
|
|
|
|
/*
|
|
#cgo CFLAGS: -march=native -Ofast -std=c99
|
|
#include "flac_crc.h"
|
|
*/
|
|
import "C"
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
func flacCrc8(data []byte) uint8 {
|
|
defer runtime.KeepAlive(data)
|
|
return uint8(C.flac_crc8((*C.uint8_t)(unsafe.SliceData(data)), C.size_t(len(data))))
|
|
}
|
|
|
|
func flacCrc16(data []byte) uint16 {
|
|
defer runtime.KeepAlive(data)
|
|
return uint16(C.flac_crc16((*C.uint8_t)(unsafe.SliceData(data)), C.size_t(len(data))))
|
|
}
|