summaryrefslogtreecommitdiffstats
path: root/src/erasure-code/jerasure/gf-complete/include/gf_w32.h
blob: 7734f30ffd8e00c8d16b93c977bd74616757815b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * GF-Complete: A Comprehensive Open Source Library for Galois Field Arithmetic
 * James S. Plank, Ethan L. Miller, Kevin M. Greenan,
 * Benjamin A. Arnold, John A. Burnum, Adam W. Disney, Allen C. McBride.
 *
 * gf_w32.h
 *
 * Defines and data structures for 32-bit Galois fields
 */

#ifndef GF_COMPLETE_GF_W32_H
#define GF_COMPLETE_GF_W32_H

#include <stdint.h>

#define GF_FIELD_WIDTH (32)
#define GF_FIRST_BIT ((gf_val_32_t)1 << 31)

#define GF_BASE_FIELD_WIDTH (16)
#define GF_BASE_FIELD_SIZE       (1 << GF_BASE_FIELD_WIDTH)
#define GF_BASE_FIELD_GROUP_SIZE  GF_BASE_FIELD_SIZE-1
#define GF_MULTBY_TWO(p) (((p) & GF_FIRST_BIT) ? (((p) << 1) ^ h->prim_poly) : (p) << 1)

struct gf_split_2_32_lazy_data {
    uint32_t      tables[16][4];
    uint32_t      last_value;
};

struct gf_w32_split_8_8_data {
    uint32_t      tables[7][256][256];
    uint32_t      region_tables[4][256];
    uint32_t      last_value;
};

struct gf_w32_group_data {
    uint32_t *reduce;
    uint32_t *shift;
    int      tshift;
    uint64_t rmask;
    uint32_t *memory;
};

struct gf_split_16_32_lazy_data {
    uint32_t      tables[2][(1<<16)];
    uint32_t      last_value;
};

struct gf_split_8_32_lazy_data {
    uint32_t      tables[4][256];
    uint32_t      last_value;
};

struct gf_split_4_32_lazy_data {
    uint32_t      tables[8][16];
    uint32_t      last_value;
};

struct gf_w32_bytwo_data {
    uint64_t prim_poly;
    uint64_t mask1;
    uint64_t mask2;
};

struct gf_w32_composite_data {
  uint16_t *log;
  uint16_t *alog;
};

void gf_w32_neon_split_init(gf_t *gf);

#endif /* GF_COMPLETE_GF_W32_H */