Merge tag 'v2.0.0' into debian/unstable
Adding tag for easier downstream trackingmaster
commit
896b4a2fc4
BIN
Manual.pdf
BIN
Manual.pdf
Binary file not shown.
6
README
6
README
|
@ -9,8 +9,10 @@ Authors: James S. Plank (University of Tennessee)
|
|||
|
||||
External Documentation:
|
||||
|
||||
See the file Manual.pdf for the programmer's manual and tutorial. This manual
|
||||
is also available at http://web.eecs.utk.edu/~plank/plank/papers/UT-EECS-14-721.html.
|
||||
The programmer's manual and tutorial is provided in two places:
|
||||
|
||||
1.) A copy is hosted on BitBucket at https://bitbucket.org/jimplank/jerasure/downloads/Jerasure-Manual.pdf
|
||||
2.) A copy is also available at http://web.eecs.utk.edu/~plank/plank/papers/UT-EECS-14-721.html
|
||||
|
||||
See https://bitbucket.org/jimplank/gf-complete for GF-Complete.
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void galois_init_default_field(int w);
|
||||
extern int 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);
|
||||
|
|
47
src/galois.c
47
src/galois.c
|
@ -47,6 +47,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "galois.h"
|
||||
|
||||
|
@ -168,24 +169,34 @@ gf_t* galois_init_composite_field(int w,
|
|||
return gfp;
|
||||
}
|
||||
|
||||
void galois_init_default_field(int w)
|
||||
int galois_init_default_field(int w)
|
||||
{
|
||||
if (gfp_array[w] == NULL) {
|
||||
gfp_array[w] = (gf_t*)malloc(sizeof(gf_t));
|
||||
if(gfp_array[w] == NULL)
|
||||
return ENOMEM;
|
||||
if (!gf_init_easy(gfp_array[w], w))
|
||||
return EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void galois_init(int w)
|
||||
{
|
||||
if (w <= 0 || w > 32) {
|
||||
fprintf(stderr, "ERROR -- cannot init default Galois field for w=%d\n", w);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (gfp_array[w] == NULL) {
|
||||
gfp_array[w] = (gf_t*)malloc(sizeof(gf_t));
|
||||
if (gfp_array[w] == NULL) {
|
||||
fprintf(stderr, "ERROR -- cannot allocate memory for Galois field w=%d\n", w);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!gf_init_easy(gfp_array[w], w)) {
|
||||
switch (galois_init_default_field(w)) {
|
||||
case ENOMEM:
|
||||
fprintf(stderr, "ERROR -- cannot allocate memory for Galois field w=%d\n", w);
|
||||
exit(1);
|
||||
break;
|
||||
case EINVAL:
|
||||
fprintf(stderr, "ERROR -- cannot init default Galois field for w=%d\n", w);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,7 +254,7 @@ int galois_single_multiply(int x, int y, int w)
|
|||
if (x == 0 || y == 0) return 0;
|
||||
|
||||
if (gfp_array[w] == NULL) {
|
||||
galois_init_default_field(w);
|
||||
galois_init(w);
|
||||
}
|
||||
|
||||
if (w <= 32) {
|
||||
|
@ -260,7 +271,7 @@ int galois_single_divide(int x, int y, int w)
|
|||
if (y == 0) return -1;
|
||||
|
||||
if (gfp_array[w] == NULL) {
|
||||
galois_init_default_field(w);
|
||||
galois_init(w);
|
||||
}
|
||||
|
||||
if (w <= 32) {
|
||||
|
@ -278,7 +289,7 @@ void galois_w08_region_multiply(char *region, /* Region to multiply */
|
|||
int add)
|
||||
{
|
||||
if (gfp_array[8] == NULL) {
|
||||
galois_init_default_field(8);
|
||||
galois_init(8);
|
||||
}
|
||||
gfp_array[8]->multiply_region.w32(gfp_array[8], region, r2, multby, nbytes, add);
|
||||
}
|
||||
|
@ -290,7 +301,7 @@ void galois_w16_region_multiply(char *region, /* Region to multiply */
|
|||
int add)
|
||||
{
|
||||
if (gfp_array[16] == NULL) {
|
||||
galois_init_default_field(16);
|
||||
galois_init(16);
|
||||
}
|
||||
gfp_array[16]->multiply_region.w32(gfp_array[16], region, r2, multby, nbytes, add);
|
||||
}
|
||||
|
@ -303,7 +314,7 @@ void galois_w32_region_multiply(char *region, /* Region to multiply */
|
|||
int add)
|
||||
{
|
||||
if (gfp_array[32] == NULL) {
|
||||
galois_init_default_field(32);
|
||||
galois_init(32);
|
||||
}
|
||||
gfp_array[32]->multiply_region.w32(gfp_array[32], region, r2, multby, nbytes, add);
|
||||
}
|
||||
|
@ -311,7 +322,7 @@ void galois_w32_region_multiply(char *region, /* Region to multiply */
|
|||
void galois_w8_region_xor(void *src, void *dest, int nbytes)
|
||||
{
|
||||
if (gfp_array[8] == NULL) {
|
||||
galois_init_default_field(8);
|
||||
galois_init(8);
|
||||
}
|
||||
gfp_array[8]->multiply_region.w32(gfp_array[32], src, dest, 1, nbytes, 1);
|
||||
}
|
||||
|
@ -319,7 +330,7 @@ void galois_w8_region_xor(void *src, void *dest, int nbytes)
|
|||
void galois_w16_region_xor(void *src, void *dest, int nbytes)
|
||||
{
|
||||
if (gfp_array[16] == NULL) {
|
||||
galois_init_default_field(16);
|
||||
galois_init(16);
|
||||
}
|
||||
gfp_array[16]->multiply_region.w32(gfp_array[16], src, dest, 1, nbytes, 1);
|
||||
}
|
||||
|
@ -327,7 +338,7 @@ void galois_w16_region_xor(void *src, void *dest, int nbytes)
|
|||
void galois_w32_region_xor(void *src, void *dest, int nbytes)
|
||||
{
|
||||
if (gfp_array[32] == NULL) {
|
||||
galois_init_default_field(32);
|
||||
galois_init(32);
|
||||
}
|
||||
gfp_array[32]->multiply_region.w32(gfp_array[32], src, dest, 1, nbytes, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue