On Fri, Mar 04, 2022 at 07:53:44AM +0000, David Laight wrote: > > That can be speeded up by using the identity: > table[x ^ y] == table[x] ^ table[y] > > something like: > crc = poly; /* actually crc(1) */ > table[0] = 0; > table[1] = crc; > for (i = 2; i < 8; i++) [ > crc = crc & 1 ? (crc >> 1) ^ poly : crc >> 1; > for (j = 0; j < 1u << i; j++) > table[j + (1i << i)] = table[j] ^ crc; > } > > I think the same code can be used for a normal MSB first crc > provided both the polynomial and crc(1) are passed in. > > OTOH initialisation speed may not matter. I don't think speed is an issue here. This part is executed just once for the initial kernel compile, then never again.