This function get the result of adding the bytes in data to the crc
(data []byte, model CRCModel, crcResult uint8, table []uint8)
| 36 | |
| 37 | // This function get the result of adding the bytes in data to the crc |
| 38 | func 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. |
| 53 | func getTable(model CRCModel) []uint8 { |