public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Marginally faster nand_ecc.c
@ 2006-09-22 21:58 Charles Manning
  0 siblings, 0 replies; only message in thread
From: Charles Manning @ 2006-09-22 21:58 UTC (permalink / raw)
  To: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

Folks

Herewith a patch that speeds up nand_ecc.c slightly. This should speed it up 
to be the same as yaffs_ecc.c which runs approx 15% faster than regular 
nand_ecc.c in the tests I have done.

All we're doing is moving the masking to outside the loop so we only take the 
hit once.

-- CHarles



[-- Attachment #2: nand_ecc_patch --]
[-- Type: text/x-diff, Size: 469 bytes --]

--- nand_ecc.c.orig	2006-09-23 09:51:09.000000000 +1200
+++ nand_ecc.c	2006-09-23 09:52:12.000000000 +1200
@@ -128,7 +128,7 @@
 
 		/* Get CP0 - CP5 from table */
 		idx = nand_ecc_precalc_table[dat[j]];
-		reg1 ^= (idx & 0x3f);
+		reg1 ^= idx;
 
 		/* All bit XOR = 1 ? */
 		if (idx & 0x40) {
@@ -136,6 +136,8 @@
 			reg2 ^= ~((u_char) j);
 		}
 	}
+	
+	reg1 &= 0x3f;
 
 	/* Create non-inverted ECC code from line parity */
 	nand_trans_result(reg2, reg3, ecc_code);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-09-22 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-22 21:58 Marginally faster nand_ecc.c Charles Manning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox