Commit a98f2f1969c4a5a36afb395cf4452618b06ae915

Authored by Yuriy M. Kaminskiy
1 parent 26a8fa2f
Exists in fix-carry-free

gf_methods: add check with extra prim_poly

Adds missing coverage test for gf_w{8,16,32}_clm_multiply_{2,3,4}
Showing 1 changed file with 30 additions and 4 deletions   Show diff stats
tools/gf_methods.c
... ... @@ -37,6 +37,17 @@ static char *BREGIONS[BNREGIONS] = { "DOUBLE", "QUAD", "ALTMAP", "CAUCHY" };
37 37 #define NDIVS (2)
38 38 static char *divides[NDIVS] = { "MATRIX", "EUCLID" };
39 39  
  40 +static char *extra_poly[][3] = {
  41 + /* 8 */ [3] = { "169", "12d", /* "11d" */ NULL },
  42 + /* 16 */ [4] = { /* "1100b", */ "103dd", "1002d", NULL },
  43 + /* 32 */ [5] = { /* "100400007", */ "1000000c5", NULL },
  44 + /* ^^ TODO: add pp in 0x00020000..0x003fffff range */
  45 + /* 64 */ [6] = { /* "000000000000001b", */ NULL },
  46 + /* ^^ TODO: add pp in 0x0000000200000000..0x0001ffffffffffff range */
  47 + /* 128 */ [7] = { /* "00000000000000000000000000000087", */ NULL },
  48 + /* ^^ TODO TBD */
  49 +};
  50 +
40 51 void usage(char *s)
41 52 {
42 53 fprintf(stderr, "usage: gf_methods w -BADC -LXUMDRB\n");
... ... @@ -92,6 +103,8 @@ int main(int argc, char *argv[])
92 103 gf_t gf;
93 104 char ls[10];
94 105 char * w_str;
  106 + int wlog;
  107 + int ep, epa;
95 108  
96 109 if (argc != 4) usage(NULL);
97 110 w = atoi(argv[1]);
... ... @@ -126,10 +139,22 @@ int main(int argc, char *argv[])
126 139 *x = listing;
127 140 }
128 141  
129   - gf_argv[0] = "-";
130   - if (create_gf_from_argv(&gf, w, 1, gf_argv, 0) > 0) {
  142 + for (wlog = 0; wlog < 7; wlog++)
  143 + if (w == (1<<wlog))
  144 + break;
  145 +
  146 +ep = 0;
  147 +do {
  148 + epa = 0;
  149 + if (extra_poly[wlog][ep]) { /* NULL implies default prim_poly */
  150 + gf_argv[epa++] = "-p";
  151 + gf_argv[epa++] = extra_poly[wlog][ep];
  152 + }
  153 + gf_argv[epa+0] = "-";
  154 + if (create_gf_from_argv(&gf, w, epa + 1, gf_argv, 0) > 0) {
131 155 printf(w_str, w);
132   - printf(" - \n");
  156 + for (j = 0; j < epa + 1; j++) printf(" %s", gf_argv[j]);
  157 + printf("\n");
133 158 gf_free(&gf, 1);
134 159 } else if (_gf_errno == GF_E_DEFAULT) {
135 160 fprintf(stderr, "Unlabeled failed method: w=%d: -\n", 2);
... ... @@ -144,7 +169,7 @@ int main(int argc, char *argv[])
144 169  
145 170  
146 171 for (m = 0; m < nmults; m++) {
147   - sa = 0;
  172 + sa = epa;
148 173 gf_argv[sa++] = "-m";
149 174 if (strcmp(mults[m], "GROUP44") == 0) {
150 175 gf_argv[sa++] = "GROUP";
... ... @@ -242,5 +267,6 @@ int main(int argc, char *argv[])
242 267 }
243 268 }
244 269 }
  270 +} while(extra_poly[wlog][ep++]);
245 271 return 0;
246 272 }
... ...