- private static final int PRIMITIVE = 0x011D;
- private static final int[] exp = new int[256];
- private static final int[] log = new int[256];
- static {
+ public static final GF256 QR_CODE_FIELD = new GF256(0x011D); // x^8 + x^4 + x^3 + x^2 + 1
+ public static final GF256 DATA_MATRIX_FIELD = new GF256(0x012D); // x^8 + x^5 + x^3 + x^2 + 1
+
+ private final int[] expTable;
+ private final int[] logTable;
+ private final GF256Poly zero;
+ private final GF256Poly one;
+
+ /**
+ * Create a representation of GF(256) using the given primitive polynomial.
+ *
+ * @param primitive irreducible polynomial whose coefficients are represented by
+ * the bits of an int, where the least-significant bit represents the constant
+ * coefficient
+ */
+ private GF256(int primitive) {
+ expTable = new int[256];
+ logTable = new int[256];