70 ERROR(
"memory allocation fail");
71 for(
int i=0; i < syn->
wei; i++)
76 for(
int j=0 ; j < err->
wei; j++)
86 static inline void two_vec_print(
const two_vec_t *
const it){
88 printf(
"two_vec_print(): null structure!\n");
91 printf(
"# two_vec: w_e=%d e=[",it->
w_e);
92 for(
int i=0; i < it->
w_e; i++)
93 printf(
" %d",it->
err[i]);
94 printf(
" ]%s w_s=%d s=[",it->
w_s>20?
"\n#":
" ",it->
w_s);
95 for(
int i=0; i < it->
w_s; i++)
96 printf(
" %d",it->
syn[i]);
109 static inline int by_syndrome(
void *a,
void *b){
114 else if (pa->
w_s > pb->
w_s)
117 for(
int i=0; i < pa->
w_s; i++){
118 if (pa->
syn[i] < pb->
syn[i])
120 else if (pa->
syn[i] > pb->
syn[i])
136 static inline int by_error(
void *a,
void *b){
141 else if (pa->
w_e > pb->
w_e)
144 for(
int i=0; i < pa->
w_e; i++){
145 if (pa->
err[i] < pb->
err[i])
147 else if (pa->
err[i] > pb->
err[i])
168 __attribute__ ((unused))
const int debug){
170 const size_t keylen = syn->
wei *
sizeof(int);
171 if(p_swei[err->
wei] > syn->
wei){
174 printf(
"# swei[%d]=%d -> %d change\n# err: ",
181 p_swei[err->
wei]=syn->
wei;
186 printf(
"p_swei[%d]=%d swei=%d not small enough\n",err->
wei,p_swei[err->
wei],syn->
wei);
195 entry = two_vec_init(syn, err);
206 printf(
"already in the hash:\n");
structure to hold two sparse vectors (syndrome,error) in a hash
#define HASH_ADD(hh, head, fieldname, keylen_in, add)
#define HASH_FIND(hh, head, keyptr, keylen, out)
struct TWO_VEC_T two_vec_t
structure to hold two sparse vectors (syndrome,error) in a hash
void one_vec_print(const one_vec_t *const pvec)
Print a one_vec_t structure (indices and weight) to stdout.
struct ONE_VEC_T one_vec_t