lkml.org 
[lkml]   [2022]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv4 5/8] lib: add rocksoft model crc64
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.

\
 
 \ /
  Last update: 2022-03-04 16:03    [W:0.108 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site