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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 int32_t& e) { | 78 int32_t& e) { |
79 if (degree < 0) { | 79 if (degree < 0) { |
80 e = BCExceptionDegreeIsNegative; | 80 e = BCExceptionDegreeIsNegative; |
81 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); | 81 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
82 } | 82 } |
83 if (coefficient == 0) { | 83 if (coefficient == 0) { |
84 CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e); | 84 CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e); |
85 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); | 85 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
86 return temp; | 86 return temp; |
87 } | 87 } |
88 CFX_Int32Array coefficients; | 88 CFX_ArrayTemplate<int32_t> coefficients; |
89 coefficients.SetSize(degree + 1); | 89 coefficients.SetSize(degree + 1); |
90 coefficients[0] = coefficient; | 90 coefficients[0] = coefficient; |
91 CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); | 91 CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly(); |
92 temp->Init(this, &coefficients, e); | 92 temp->Init(this, &coefficients, e); |
93 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); | 93 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
94 return temp; | 94 return temp; |
95 } | 95 } |
96 | 96 |
97 int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) { | 97 int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) { |
98 return a ^ b; | 98 return a ^ b; |
(...skipping 24 matching lines...) Expand all Loading... |
123 return 0; | 123 return 0; |
124 } | 124 } |
125 if (a == 1) { | 125 if (a == 1) { |
126 return b; | 126 return b; |
127 } | 127 } |
128 if (b == 1) { | 128 if (b == 1) { |
129 return a; | 129 return a; |
130 } | 130 } |
131 return m_expTable[(m_logTable[a] + m_logTable[b]) % 255]; | 131 return m_expTable[(m_logTable[a] + m_logTable[b]) % 255]; |
132 } | 132 } |
OLD | NEW |