Commit 5c9577172c9ba29890c821692dd4a9f9790b20d8

Authored by Loic Dachary
1 parent 80fc5d1d
Exists in master

make galois_init_default_field(int w) extern

So that the application can initialize gfp_array and gfp_is_composite
instead of relying on initialization happening implicitly when the
multiply or xor functions are called. The init function can be called
once when the application guarantees thread safety. And the multiply and
xor functions can be called from multiple threads without risking races.

Signed-off-by: Loic Dachary <loic@dachary.org>
Showing 2 changed files with 2 additions and 1 deletions   Show diff stats
include/galois.h
... ... @@ -46,6 +46,7 @@
46 46 extern "C" {
47 47 #endif
48 48  
  49 +extern void galois_init_default_field(int w);
49 50 extern void galois_change_technique(gf_t *gf, int w);
50 51  
51 52 extern int galois_single_multiply(int a, int b, int w);
... ...
src/galois.c
... ... @@ -168,7 +168,7 @@ gf_t* galois_init_composite_field(int w,
168 168 return gfp;
169 169 }
170 170  
171   -static void galois_init_default_field(int w)
  171 +void galois_init_default_field(int w)
172 172 {
173 173 if (w <= 0 || w > 32) {
174 174 fprintf(stderr, "ERROR -- cannot init default Galois field for w=%d\n", w);
... ...