crc32() optimization

Marc Singer elf at buici.com
Sun Nov 10 19:50:04 EST 2002


On Sun, Nov 10, 2002 at 08:25:38PM +0100, Wolfgang Denk wrote:
> 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.

That's what I get for writing it from memory.

> Also, Duff's Device comes to mind.

What would that be?


> 
> 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