MCPcopy Index your code
hub / github.com/aceld/zinx / GetCrC

Function GetCrC

zdecoder/crc.go:61–76  ·  view source on GitHub ↗
(buff []byte)

Source from the content-addressed store, hash-verified

59}
60
61func GetCrC(buff []byte) []byte {
62 var hi uint16 = 0x00ff
63 var low uint16 = 0x00ff
64
65 for i := 0; i < len(buff); i++ {
66 pos := (low ^ uint16(buff[i])) & 0x00ff
67 low = hi ^ uint16(crc16_h[pos])
68 hi = uint16(crc16_l[pos])
69 }
70
71 var d_crc = ((hi & 0x00ff) << 8) | (low&0x00ff)&0xffff
72 //var d_crcArr = [2]byte{byte((d_crc & 0xff)), byte((d_crc >> 8) & 0xff)}
73 d_crcArr := make([]byte, 0)
74 d_crcArr = append(d_crcArr, byte((d_crc & 0xff)), byte((d_crc>>8)&0xff))
75 return d_crcArr
76}
77
78func IsComplete(src []byte, dst []byte) bool {
79 if src != nil && dst != nil {

Callers 6

pack14Function · 0.92
pack16Function · 0.92
pack15Function · 0.92
pack13Function · 0.92
pack10Function · 0.92
CheckCRCFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected