crc32() optimization

Wolfgang Denk wd at denx.de
Sun Nov 10 14:25:38 EST 2002


In message <20021110184321.GB16087 at 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 at denx.de
See us @ electronica 2002 in Munich, Nov 12-15, Hall A3, Booth A3.325 




More information about the linux-mtd mailing list