MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / addBytes

Function addBytes

checksum/crc8.go:38–50  ·  view source on GitHub ↗

This function get the result of adding the bytes in data to the crc

(data []byte, model CRCModel, crcResult uint8, table []uint8)

Source from the content-addressed store, hash-verified

36
37// This function get the result of adding the bytes in data to the crc
38func addBytes(data []byte, model CRCModel, crcResult uint8, table []uint8) uint8 {
39 if model.RefIn {
40 for _, d := range data {
41 d = bits.Reverse8(d)
42 crcResult = table[crcResult^d]
43 }
44 return crcResult
45 }
46 for _, d := range data {
47 crcResult = table[crcResult^d]
48 }
49 return crcResult
50}
51
52// This function get 256-byte (256x8) table for efficient processing.
53func getTable(model CRCModel) []uint8 {

Callers 1

CRC8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected