[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809
luizcroc
luizcroc at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:31:51 UTC 2010
The following commit has been merged in the upstream branch:
commit 81ca8ccb10433c233caf894041d7c36bfcc66bca
Author: luizcroc <luizcroc at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date: Mon May 31 20:58:49 2010 +0000
Same change as Revision r1395 for C++ port: Small speedup, per issue 422
git-svn-id: http://zxing.googlecode.com/svn/trunk@1404 59b500cc-1b3d-0410-9834-0bbf25fbcc57
diff --git a/cpp/core/src/zxing/common/reedsolomon/GF256.cpp b/cpp/core/src/zxing/common/reedsolomon/GF256.cpp
index 35fc692..51b621e 100644
--- a/cpp/core/src/zxing/common/reedsolomon/GF256.cpp
+++ b/cpp/core/src/zxing/common/reedsolomon/GF256.cpp
@@ -109,13 +109,10 @@ int GF256::multiply(int a, int b) {
if (a == 0 || b == 0) {
return 0;
}
- if (a == 1) {
- return b;
- }
- if (b == 1) {
- return a;
- }
- return exp_[(log_[a] + log_[b]) % 255];
+ int logSum = log_[a] + log_[b];
+ // index is a sped-up alternative to logSum % 255 since sum
+ // is in [0,510]. Thanks to jmsachs for the idea
+ return exp_[(logSum & 0xFF) + (logSum >> 8)];
}
GF256 GF256::QR_CODE_FIELD(0x011D); // x^8 + x^4 + x^3 + x^2 + 1
--
Multi-format 1D/2D barcode image processing library
More information about the Pkg-google-commits
mailing list