Re: crc32() optimization

Wolfgang Denk
2002-11-10T18:55:35Z

In message <20021110184321.GB16087@buici.com> you wrote:
> As it should. I wonder if you'd do better changing the loop slightly.
>
> Check for len == 0 and do a short-circuit return. Then do this
>
> for (++len; len & 0x7; len >>= 3) {
> ONCE(); // repeat eight times
> ...
> len >>= 3;
> }
> while (--len > 0)
> ONCE();
>
> This is the implementation I've written for another project which

Seems broken to me, since you "len >>= 3" twice.

Also, Duff's Device comes to mind.

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd@denx.de
See us @ electronica 2002 in Munich, Nov 12-15, Hall A3, Booth A3.325