Skip to contentSkip to conversation

Marginally faster nand_ecc.c

PATCH Charles Manning 1 participant 1 message Sep 22, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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

nand_ecc.c renamed from nand_ecc.c.orig +3 -1
@@ -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);