Small speedup, per issue 422

git-svn-id: https://zxing.googlecode.com/svn/trunk@1395 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-05-28 15:39:11 +00:00
parent c6f29f2ebc
commit a86b0e7cf3

View file

@ -130,13 +130,10 @@ public final class GF256 {
if (a == 0 || b == 0) { if (a == 0 || b == 0) {
return 0; return 0;
} }
if (a == 1) { int logSum = logTable[a] + logTable[b];
return b; // index is a sped-up alternative to logSum % 255 since sum
} // is in [0,510]. Thanks to jmsachs for the idea
if (b == 1) { return expTable[(logSum & 0xFF) + (logSum >>> 8)];
return a;
}
return expTable[(logTable[a] + logTable[b]) % 255];
} }
} }