| 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 2012 ZXing authors | 8 * Copyright 2012 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 result = m_field->add(m_field->multiply(a, result), m_coefficients[i]); | 87 result = m_field->add(m_field->multiply(a, result), m_coefficients[i]); |
| 88 } | 88 } |
| 89 return result; | 89 return result; |
| 90 } | 90 } |
| 91 CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add( | 91 CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::add( |
| 92 CBC_PDF417ECModulusPoly* other, | 92 CBC_PDF417ECModulusPoly* other, |
| 93 int32_t& e) { | 93 int32_t& e) { |
| 94 CBC_PDF417ECModulusPoly* modulusPoly = NULL; | 94 CBC_PDF417ECModulusPoly* modulusPoly = NULL; |
| 95 if (isZero()) { | 95 if (isZero()) { |
| 96 modulusPoly = new CBC_PDF417ECModulusPoly(other->getField(), | 96 modulusPoly = new CBC_PDF417ECModulusPoly(other->getField(), |
| 97 other->getCoefficients(), e); | 97 other->getCoefficients(), e); |
| 98 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 98 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 99 return modulusPoly; | 99 return modulusPoly; |
| 100 } | 100 } |
| 101 if (other->isZero()) { | 101 if (other->isZero()) { |
| 102 modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e); | 102 modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e); |
| 103 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 103 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 104 return modulusPoly; | 104 return modulusPoly; |
| 105 } | 105 } |
| 106 CFX_Int32Array smallerCoefficients; | 106 CFX_Int32Array smallerCoefficients; |
| 107 smallerCoefficients.Copy(m_coefficients); | 107 smallerCoefficients.Copy(m_coefficients); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 modulusPoly = add(poly, e); | 142 modulusPoly = add(poly, e); |
| 143 delete poly; | 143 delete poly; |
| 144 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 144 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 145 return modulusPoly; | 145 return modulusPoly; |
| 146 } | 146 } |
| 147 CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply( | 147 CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply( |
| 148 CBC_PDF417ECModulusPoly* other, | 148 CBC_PDF417ECModulusPoly* other, |
| 149 int32_t& e) { | 149 int32_t& e) { |
| 150 CBC_PDF417ECModulusPoly* modulusPoly = NULL; | 150 CBC_PDF417ECModulusPoly* modulusPoly = NULL; |
| 151 if (isZero() || other->isZero()) { | 151 if (isZero() || other->isZero()) { |
| 152 modulusPoly = new CBC_PDF417ECModulusPoly( | 152 modulusPoly = |
| 153 m_field->getZero()->getField(), m_field->getZero()->getCoefficients(), | 153 new CBC_PDF417ECModulusPoly(m_field->getZero()->getField(), |
| 154 e); | 154 m_field->getZero()->getCoefficients(), e); |
| 155 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 155 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 156 return modulusPoly; | 156 return modulusPoly; |
| 157 } | 157 } |
| 158 CFX_Int32Array aCoefficients; | 158 CFX_Int32Array aCoefficients; |
| 159 aCoefficients.Copy(m_coefficients); | 159 aCoefficients.Copy(m_coefficients); |
| 160 int32_t aLength = aCoefficients.GetSize(); | 160 int32_t aLength = aCoefficients.GetSize(); |
| 161 CFX_Int32Array bCoefficients; | 161 CFX_Int32Array bCoefficients; |
| 162 bCoefficients.Copy(other->m_coefficients); | 162 bCoefficients.Copy(other->m_coefficients); |
| 163 int32_t bLength = bCoefficients.GetSize(); | 163 int32_t bLength = bCoefficients.GetSize(); |
| 164 CFX_Int32Array product; | 164 CFX_Int32Array product; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 183 } | 183 } |
| 184 CBC_PDF417ECModulusPoly* modulusPoly = | 184 CBC_PDF417ECModulusPoly* modulusPoly = |
| 185 new CBC_PDF417ECModulusPoly(m_field, negativeCoefficients, e); | 185 new CBC_PDF417ECModulusPoly(m_field, negativeCoefficients, e); |
| 186 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 186 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 187 return modulusPoly; | 187 return modulusPoly; |
| 188 } | 188 } |
| 189 CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(int32_t scalar, | 189 CBC_PDF417ECModulusPoly* CBC_PDF417ECModulusPoly::multiply(int32_t scalar, |
| 190 int32_t& e) { | 190 int32_t& e) { |
| 191 CBC_PDF417ECModulusPoly* modulusPoly = NULL; | 191 CBC_PDF417ECModulusPoly* modulusPoly = NULL; |
| 192 if (scalar == 0) { | 192 if (scalar == 0) { |
| 193 modulusPoly = new CBC_PDF417ECModulusPoly( | 193 modulusPoly = |
| 194 m_field->getZero()->getField(), m_field->getZero()->getCoefficients(), | 194 new CBC_PDF417ECModulusPoly(m_field->getZero()->getField(), |
| 195 e); | 195 m_field->getZero()->getCoefficients(), e); |
| 196 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 196 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 197 return modulusPoly; | 197 return modulusPoly; |
| 198 } | 198 } |
| 199 if (scalar == 1) { | 199 if (scalar == 1) { |
| 200 modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e); | 200 modulusPoly = new CBC_PDF417ECModulusPoly(m_field, m_coefficients, e); |
| 201 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 201 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
| 202 return modulusPoly; | 202 return modulusPoly; |
| 203 } | 203 } |
| 204 int32_t size = m_coefficients.GetSize(); | 204 int32_t size = m_coefficients.GetSize(); |
| 205 CFX_Int32Array product; | 205 CFX_Int32Array product; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 result += 'x'; | 322 result += 'x'; |
| 323 } else { | 323 } else { |
| 324 result += "x^"; | 324 result += "x^"; |
| 325 result += degree; | 325 result += degree; |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 return result; | 330 return result; |
| 331 } | 331 } |
| OLD | NEW |