Lines Matching refs:rs
11 rs = NULL;
26 rs = (struct rs *)calloc(1,sizeof(struct rs));
27 if(rs == NULL)
30 rs->mm = symsize;
31 rs->nn = (1<<symsize)-1;
32 rs->pad = pad;
34 rs->alpha_to = (data_t *)malloc(sizeof(data_t)*(rs->nn+1));
35 if(rs->alpha_to == NULL){
36 free(rs);
37 rs = NULL;
40 rs->index_of = (data_t *)malloc(sizeof(data_t)*(rs->nn+1));
41 if(rs->index_of == NULL){
42 free(rs->alpha_to);
43 free(rs);
44 rs = NULL;
49 rs->index_of[0] = A0; /* log(zero) = -inf */
50 rs->alpha_to[A0] = 0; /* alpha**-inf = 0 */
52 for(i=0;i<rs->nn;i++){
53 rs->index_of[sr] = i;
54 rs->alpha_to[i] = sr;
58 sr &= rs->nn;
62 free(rs->alpha_to);
63 free(rs->index_of);
64 free(rs);
65 rs = NULL;
70 rs->genpoly = (data_t *)malloc(sizeof(data_t)*(nroots+1));
71 if(rs->genpoly == NULL){
72 free(rs->alpha_to);
73 free(rs->index_of);
74 free(rs);
75 rs = NULL;
78 rs->fcr = fcr;
79 rs->prim = prim;
80 rs->nroots = nroots;
83 for(iprim=1;(iprim % prim) != 0;iprim += rs->nn)
85 rs->iprim = iprim / prim;
87 rs->genpoly[0] = 1;
89 rs->genpoly[i+1] = 1;
93 if (rs->genpoly[j] != 0)
94 rs->genpoly[j] = rs->genpoly[j-1] ^ rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[j]] + root)];
96 rs->genpoly[j] = rs->genpoly[j-1];
99 rs->genpoly[0] = rs->alpha_to[modnn(rs,rs->index_of[rs->genpoly[0]] + root)];
103 rs->genpoly[i] = rs->index_of[rs->genpoly[i]];