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>
master
Loic Dachary 2014-04-09 00:05:18 +02:00
parent 80fc5d1d95
commit 5c9577172c
2 changed files with 2 additions and 1 deletions

View File

@ -46,6 +46,7 @@
extern "C" {
#endif
extern void galois_init_default_field(int w);
extern void galois_change_technique(gf_t *gf, int w);
extern int galois_single_multiply(int a, int b, int w);

View File

@ -168,7 +168,7 @@ gf_t* galois_init_composite_field(int w,
return gfp;
}
static void galois_init_default_field(int w)
void galois_init_default_field(int w)
{
if (w <= 0 || w > 32) {
fprintf(stderr, "ERROR -- cannot init default Galois field for w=%d\n", w);