math/mpreduce.h: Missing include files.
[u/mdw/catacomb] / misc / gfshare.c
index 0eb076b..80a6ef6 100644 (file)
 
 #include "arena.h"
 #include "gfshare.h"
-#include "gfshare-tab.h"
 #include "grand.h"
 
 /*----- Static variables --------------------------------------------------*/
 
-static const octet gflog[] = GFSHARE_LOG, gfexp[] = GFSHARE_EXP;
+extern const octet gfshare_log[256], gfshare_exp[510];
 
 /*----- Main code ---------------------------------------------------------*/
 
@@ -121,7 +120,7 @@ void gfshare_get(gfshare *s, unsigned x, void *buf)
 {
   unsigned i;
   const octet *p = s->v;
-  unsigned ilog = gflog[x + 1];
+  unsigned ilog = gfshare_log[x + 1];
 
   /* --- Evaluate the polynomial at %$x = i + 1$% --- */
 
@@ -134,7 +133,7 @@ void gfshare_get(gfshare *s, unsigned x, void *buf)
     for (k = 0; k < s->sz; k++) {
       unsigned qq = *q;
       if (qq)
-       qq = gfexp[ilog + gflog[qq]];
+       qq = gfshare_exp[ilog + gfshare_log[qq]];
       *q++ = qq ^ *p++;
     }
   }
@@ -233,10 +232,10 @@ void gfshare_combine(gfshare *s, void *buf)
       if (i == j)
        continue;
       xj = GFSHARE_INDEX(s, j);
-      c += gflog[xj];
+      c += gfshare_log[xj];
       if (c >= 0xff)
        c -= 0xff;
-      ci += gflog[xi ^ xj];
+      ci += gfshare_log[xi ^ xj];
       if (ci >= 0xff)
        ci -= 0xff;
     }
@@ -249,7 +248,7 @@ void gfshare_combine(gfshare *s, void *buf)
     p = buf;
     for (j = 0; j < s->sz; j++) {
       if (*q)
-       *p ^= gfexp[c + gflog[*q]];
+       *p ^= gfshare_exp[c + gfshare_log[*q]];
       p++, q++;
     }
   }