8 * Created by Christian Brunschen on 05/05/2008.
9 * Copyright 2008 Google UK. All rights reserved.
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
26 #include "../Counted.h"
28 using namespace common;
30 namespace reedsolomon {
35 * <p>This class contains utility methods for performing mathematical
36 * operations over the Galois Field GF(256). Operations use a given
37 * primitive polynomial in calculations.</p>
39 * <p>Throughout this package, elements of GF(256) are represented as an
40 * <code>int</code> for convenience and speed (but at the cost of memory).
41 * Only the bottom 8 bits are really used.</p>
43 * @author srowen@google.com (Sean Owen)
44 * @author christian.brunschen@gmail.com (Christian Brunschen)
55 Ref<GF256Poly> getZero();
56 Ref<GF256Poly> getOne();
57 Ref<GF256Poly> buildMonomial(int degree, int coefficient);
58 static int addOrSubtract(int a, int b);
62 int multiply(int a, int b);
64 static GF256 QR_CODE_FIELD;
65 static GF256 DATA_MATRIX_FIELD;
67 friend ostream& operator<<(ostream& out, const GF256& field);