31 #include <m4ri/m4ri.h>
35 #if defined(DLL_EXPORT) && defined(M4RIE_BUILDING_M4RIE)
36 #define M4RIE_DLL_EXPORT __declspec(dllexport)
37 #elif defined(M4RI_USE_DLL) && !defined(M4RIE_BUILDING_M4RIE)
38 #define M4RIE_DLL_EXPORT __declspec(dllimport)
40 #define M4RIE_DLL_EXPORT
43 #define M4RIE_DLL_EXPORT
50 #define M4RIE_MAX_DEGREE 16
70 word (*
inv)(
const gf2e *ff,
const word a);
71 word (*
mul)(
const gf2e *ff,
const word a,
const word b);
103 return ff->
_mul[a][b];
119 static inline word
gf2e_mul(
const gf2e *ff,
const word a,
const word b) {
120 if( ff->
_mul != NULL )
154 m4ri_die(
"degree %d not supported.\n",ff->
degree);
167 word *mul = (word*)m4ri_mm_calloc(1<<16,
sizeof(word));
170 const word mask_w = (1<<w)-1;
175 for(word i=0; i<1<<16; i++) {
178 mul[i] =
gf2e_mul(ff, a, ((i>>0)&mask_w))<<0 |
gf2e_mul(ff, a, ((i>> 2)&mask_w))<< 2 |
gf2e_mul(ff, a, ((i>> 4)&mask_w))<< 4 |
gf2e_mul(ff, a, ((i>> 6)&mask_w))<< 6;
179 mul[i] |=
gf2e_mul(ff, a, ((i>>8)&mask_w))<<8 |
gf2e_mul(ff, a, ((i>>10)&mask_w))<<10 |
gf2e_mul(ff, a, ((i>>12)&mask_w))<<12 |
gf2e_mul(ff, a, ((i>>14)&mask_w))<<14;
188 mul[i] =
gf2e_mul(ff, a, (i&mask_w));
211 #endif //M4RIE_GF2E_H