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

Function getTable

checksum/crc8.go:53–67  ·  view source on GitHub ↗

This function get 256-byte (256x8) table for efficient processing.

(model CRCModel)

Source from the content-addressed store, hash-verified

51
52// This function get 256-byte (256x8) table for efficient processing.
53func getTable(model CRCModel) []uint8 {
54 table := make([]uint8, 256)
55 for i := 0; i < 256; i++ {
56 crc := uint8(i)
57 for j := 0; j < 8; j++ {
58 isSetBit := (crc & 0x80) != 0
59 crc <<= 1
60 if isSetBit {
61 crc ^= model.Poly
62 }
63 }
64 table[i] = crc
65 }
66 return table
67}

Callers 1

CRC8Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected