JFFS3 & performance

Jörn Engel joern at wohnheim.fh-wedel.de
Sat Dec 18 12:59:09 EST 2004


On Sat, 18 December 2004 18:51:08 +0100, Joakim Tjernlund wrote:
> 
> BTW, have you tested your crc16 for correctness?
> It doesn't give the same result as mine or Thomas versions. 

Nope.  I completely ignored the remainding byte if len is uneven and
didn't bother much about the usual corner-cases.  Xor with ~0, off by
one, all that.  It's not performance relevant, so that can be done
later.

> uint32_t crc16(uint32_t crc, const void *_s, size_t len)
> {
> 	const uint16_t *s = _s;
> 	uint32_t ret = crc;
> 	for (; len>1; len-=2,s++) {
> 		ret <<= 16;
> 		ret += *s;
> 		ret %= 65521;
> 	}
> 	return ret;
> }

Jörn

-- 
Mundie uses a textbook tactic of manipulation: start with some
reasonable talk, and lead the audience to an unreasonable conclusion.
-- Bruce Perens




More information about the linux-mtd mailing list