31 a = (a << 1) ^ (a & 0x80 ? 0x1d : 0);
60 uint8_t exptbl[256], invtbl[256];
62 printf(
"#include <linux/raid/pq.h>\n");
63 printf(
"#include <linux/export.h>\n");
66 printf(
"\nconst u8 __attribute__((aligned(256)))\n"
67 "raid6_gfmul[256][256] =\n"
69 for (i = 0; i < 256; i++) {
71 for (j = 0; j < 256; j += 8) {
73 for (k = 0; k < 8; k++)
74 printf(
"0x%02x,%c", gfmul(i, j + k),
75 (k == 7) ?
'\n' :
' ');
80 printf(
"#ifdef __KERNEL__\n");
81 printf(
"EXPORT_SYMBOL(raid6_gfmul);\n");
85 printf(
"\nconst u8 __attribute__((aligned(256)))\n"
86 "raid6_vgfmul[256][32] =\n"
88 for (i = 0; i < 256; i++) {
90 for (j = 0; j < 16; j += 8) {
92 for (k = 0; k < 8; k++)
93 printf(
"0x%02x,%c", gfmul(i, j + k),
94 (k == 7) ?
'\n' :
' ');
96 for (j = 0; j < 16; j += 8) {
98 for (k = 0; k < 8; k++)
99 printf(
"0x%02x,%c", gfmul(i, (j + k) << 4),
100 (k == 7) ?
'\n' :
' ');
105 printf(
"#ifdef __KERNEL__\n");
106 printf(
"EXPORT_SYMBOL(raid6_vgfmul);\n");
111 printf(
"\nconst u8 __attribute__((aligned(256)))\n"
112 "raid6_gfexp[256] =\n" "{\n");
113 for (i = 0; i < 256; i += 8) {
115 for (j = 0; j < 8; j++) {
117 printf(
"0x%02x,%c", v, (j == 7) ?
'\n' :
' ');
124 printf(
"#ifdef __KERNEL__\n");
125 printf(
"EXPORT_SYMBOL(raid6_gfexp);\n");
129 printf(
"\nconst u8 __attribute__((aligned(256)))\n"
130 "raid6_gfinv[256] =\n" "{\n");
131 for (i = 0; i < 256; i += 8) {
133 for (j = 0; j < 8; j++) {
134 invtbl[i +
j] = v = gfpow(i + j, 254);
135 printf(
"0x%02x,%c", v, (j == 7) ?
'\n' :
' ');
139 printf(
"#ifdef __KERNEL__\n");
140 printf(
"EXPORT_SYMBOL(raid6_gfinv);\n");
144 printf(
"\nconst u8 __attribute__((aligned(256)))\n"
145 "raid6_gfexi[256] =\n" "{\n");
146 for (i = 0; i < 256; i += 8) {
148 for (j = 0; j < 8; j++)
149 printf(
"0x%02x,%c", invtbl[exptbl[i + j] ^ 1],
150 (j == 7) ?
'\n' :
' ');
153 printf(
"#ifdef __KERNEL__\n");
154 printf(
"EXPORT_SYMBOL(raid6_gfexi);\n");