8 * Copyright 2010 ZXing authors All rights reserved.
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
25 #include <zxing/common/Counted.h>
32 * <p>This class contains utility methods for performing mathematical
33 * operations over the Galois Field GF(256). Operations use a given
34 * primitive polynomial in calculations.</p>
36 * <p>Throughout this package, elements of GF(256) are represented as an
37 * <code>int</code> for convenience and speed (but at the cost of memory).
38 * Only the bottom 8 bits are really used.</p>
40 * @author srowen@google.com (Sean Owen)
41 * @author christian.brunschen@gmail.com (Christian Brunschen)
44 std::vector<int> exp_;
45 std::vector<int> log_;
52 Ref<GF256Poly> getZero();
53 Ref<GF256Poly> getOne();
54 Ref<GF256Poly> buildMonomial(int degree, int coefficient);
55 static int addOrSubtract(int a, int b);
59 int multiply(int a, int b);
61 static GF256 QR_CODE_FIELD;
62 static GF256 DATA_MATRIX_FIELD;
64 friend std::ostream& operator<<(std::ostream& out, const GF256& field);