| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
| 7 /* | 7 /* |
| 8 * Copyright 2007 ZXing authors | 8 * Copyright 2007 ZXing authors |
| 9 * | 9 * |
| 10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 for (int32_t i = 0; i < 255; i++) { | 53 for (int32_t i = 0; i < 255; i++) { |
| 54 m_logTable[m_expTable[i]] = i; | 54 m_logTable[m_expTable[i]] = i; |
| 55 } | 55 } |
| 56 m_logTable[0] = 0; | 56 m_logTable[0] = 0; |
| 57 } | 57 } |
| 58 void CBC_ReedSolomonGF256::Init() { | 58 void CBC_ReedSolomonGF256::Init() { |
| 59 m_zero = new CBC_ReedSolomonGF256Poly(this, 0); | 59 m_zero = new CBC_ReedSolomonGF256Poly(this, 0); |
| 60 m_one = new CBC_ReedSolomonGF256Poly(this, 1); | 60 m_one = new CBC_ReedSolomonGF256Poly(this, 1); |
| 61 } | 61 } |
| 62 CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() { | 62 CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() { |
| 63 if (m_zero != NULL) { | 63 delete m_zero; |
| 64 delete m_zero; | 64 delete m_one; |
| 65 m_zero = NULL; | |
| 66 } | |
| 67 if (m_one != NULL) { | |
| 68 delete m_one; | |
| 69 m_one = NULL; | |
| 70 } | |
| 71 } | 65 } |
| 72 CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() { | 66 CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() { |
| 73 return m_zero; | 67 return m_zero; |
| 74 } | 68 } |
| 75 CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() { | 69 CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() { |
| 76 return m_one; | 70 return m_one; |
| 77 } | 71 } |
| 78 CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial( | 72 CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial( |
| 79 int32_t degree, | 73 int32_t degree, |
| 80 int32_t coefficient, | 74 int32_t coefficient, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 return 0; | 115 return 0; |
| 122 } | 116 } |
| 123 if (a == 1) { | 117 if (a == 1) { |
| 124 return b; | 118 return b; |
| 125 } | 119 } |
| 126 if (b == 1) { | 120 if (b == 1) { |
| 127 return a; | 121 return a; |
| 128 } | 122 } |
| 129 return m_expTable[(m_logTable[a] + m_logTable[b]) % 255]; | 123 return m_expTable[(m_logTable[a] + m_logTable[b]) % 255]; |
| 130 } | 124 } |
| OLD | NEW |