diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
commit | 9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch) | |
tree | c97037f398d714665aefccb6eb54d0969ad7030c /xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp | |
parent | 780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff) | |
download | pdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz |
XFA: clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \
xargs ../../buildtools/mac/clang-format -i
Then manually merged https://codereview.chromium.org/1269223002/
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
Diffstat (limited to 'xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp')
-rw-r--r-- | xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp | 188 |
1 files changed, 89 insertions, 99 deletions
diff --git a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp index 426ac2fbd8..43c8c82a4d 100644 --- a/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp +++ b/xfa/src/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp @@ -23,118 +23,108 @@ #include "../../barcode.h"
#include "BC_ReedSolomonGF256Poly.h"
#include "BC_ReedSolomonGF256.h"
-CBC_ReedSolomonGF256 *CBC_ReedSolomonGF256::QRCodeFild = NULL;
-CBC_ReedSolomonGF256 *CBC_ReedSolomonGF256::DataMatrixField = NULL;
-void CBC_ReedSolomonGF256::Initialize()
-{
- QRCodeFild = FX_NEW CBC_ReedSolomonGF256(0x011D);
- QRCodeFild->Init();
- DataMatrixField = FX_NEW CBC_ReedSolomonGF256(0x012D);
- DataMatrixField->Init();
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeFild = NULL;
+CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = NULL;
+void CBC_ReedSolomonGF256::Initialize() {
+ QRCodeFild = FX_NEW CBC_ReedSolomonGF256(0x011D);
+ QRCodeFild->Init();
+ DataMatrixField = FX_NEW CBC_ReedSolomonGF256(0x012D);
+ DataMatrixField->Init();
}
-void CBC_ReedSolomonGF256::Finalize()
-{
- if (QRCodeFild) {
- delete QRCodeFild;
- }
- QRCodeFild = NULL;
- if (DataMatrixField) {
- delete DataMatrixField;
- }
- DataMatrixField = NULL;
+void CBC_ReedSolomonGF256::Finalize() {
+ if (QRCodeFild) {
+ delete QRCodeFild;
+ }
+ QRCodeFild = NULL;
+ if (DataMatrixField) {
+ delete DataMatrixField;
+ }
+ DataMatrixField = NULL;
}
-CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive)
-{
- int32_t x = 1;
- for(int32_t j = 0; j < 256; j++) {
- m_expTable[j] = x;
- x <<= 1;
- if(x >= 0x100) {
- x ^= primitive;
- }
+CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
+ int32_t x = 1;
+ for (int32_t j = 0; j < 256; j++) {
+ m_expTable[j] = x;
+ x <<= 1;
+ if (x >= 0x100) {
+ x ^= primitive;
}
- for(int32_t i = 0; i < 255; i++) {
- m_logTable[m_expTable[i]] = i;
- }
- m_logTable[0] = 0;
+ }
+ for (int32_t i = 0; i < 255; i++) {
+ m_logTable[m_expTable[i]] = i;
+ }
+ m_logTable[0] = 0;
}
-void CBC_ReedSolomonGF256::Init()
-{
- m_zero = FX_NEW CBC_ReedSolomonGF256Poly(this, 0);
- m_one = FX_NEW CBC_ReedSolomonGF256Poly(this, 1);
+void CBC_ReedSolomonGF256::Init() {
+ m_zero = FX_NEW CBC_ReedSolomonGF256Poly(this, 0);
+ m_one = FX_NEW CBC_ReedSolomonGF256Poly(this, 1);
}
-CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256()
-{
- if(m_zero != NULL) {
- delete m_zero;
- m_zero = NULL;
- }
- if(m_one != NULL) {
- delete m_one;
- m_one = NULL;
- }
+CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {
+ if (m_zero != NULL) {
+ delete m_zero;
+ m_zero = NULL;
+ }
+ if (m_one != NULL) {
+ delete m_one;
+ m_one = NULL;
+ }
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero()
-{
- return m_zero;
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() {
+ return m_zero;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne()
-{
- return m_one;
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() {
+ return m_one;
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(int32_t degree, int32_t coefficient, int32_t &e)
-{
- if(degree < 0) {
- e = BCExceptionDegreeIsNegative;
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- }
- if(coefficient == 0) {
- CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e);
- BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- return temp;
- }
- CFX_Int32Array coefficients;
- coefficients.SetSize(degree + 1);
- coefficients[0] = coefficient;
- CBC_ReedSolomonGF256Poly *temp = FX_NEW CBC_ReedSolomonGF256Poly();
- temp->Init(this, &coefficients, e);
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
+ int32_t degree,
+ int32_t coefficient,
+ int32_t& e) {
+ if (degree < 0) {
+ e = BCExceptionDegreeIsNegative;
+ BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ }
+ if (coefficient == 0) {
+ CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return temp;
+ }
+ CFX_Int32Array coefficients;
+ coefficients.SetSize(degree + 1);
+ coefficients[0] = coefficient;
+ CBC_ReedSolomonGF256Poly* temp = FX_NEW CBC_ReedSolomonGF256Poly();
+ temp->Init(this, &coefficients, e);
+ BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
+ return temp;
}
-int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b)
-{
- return a ^ b;
+int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) {
+ return a ^ b;
}
-int32_t CBC_ReedSolomonGF256::Exp(int32_t a)
-{
- return m_expTable[a];
+int32_t CBC_ReedSolomonGF256::Exp(int32_t a) {
+ return m_expTable[a];
}
-int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t &e)
-{
- if(a == 0) {
- e = BCExceptionAIsZero;
- BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- }
- return m_logTable[a];
+int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
+ if (a == 0) {
+ e = BCExceptionAIsZero;
+ BC_EXCEPTION_CHECK_ReturnValue(e, 0);
+ }
+ return m_logTable[a];
}
-int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t &e)
-{
- if(a == 0) {
- e = BCExceptionAIsZero;
- BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- }
- return m_expTable[255 - m_logTable[a]];
+int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
+ if (a == 0) {
+ e = BCExceptionAIsZero;
+ BC_EXCEPTION_CHECK_ReturnValue(e, 0);
+ }
+ return m_expTable[255 - m_logTable[a]];
}
-int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b)
-{
- if(a == 0 || b == 0) {
- return 0;
- }
- if(a == 1) {
- return b;
- }
- if(b == 1) {
- return a;
- }
- return m_expTable[(m_logTable[a] + m_logTable[b]) % 255];
+int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b) {
+ if (a == 0 || b == 0) {
+ return 0;
+ }
+ if (a == 1) {
+ return b;
+ }
+ if (b == 1) {
+ return a;
+ }
+ return m_expTable[(m_logTable[a] + m_logTable[b]) % 255];
}
|