File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ struct CauchyPrimeFieldErasureCoding
13
13
{
14
14
static_assert (MAX_LEN < int (PF::P-1 ), " Block length must be smaller than largest field value" );
15
15
PF temp[MAX_LEN];
16
- bool used[PF::P];
16
+ uint8_t used[( PF::P+ 7 )/ 8 ];
17
17
PF row_num, row_den;
18
18
// $a_{ij} = \frac{1}{x_i + y_j}$
19
19
PF cauchy_matrix (int i, int j)
@@ -103,12 +103,12 @@ struct CauchyPrimeFieldErasureCoding
103
103
}
104
104
int find_unused (int block_len)
105
105
{
106
- for (int i = 0 ; i < int (PF::P) ; ++i)
107
- used[i] = false ;
106
+ for (int i = 0 ; i < int (PF::P+ 7 )/ 8 ; ++i)
107
+ used[i] = 0 ;
108
108
for (int i = 0 ; i < block_len; ++i)
109
- used[temp[i]()] = true ;
109
+ used[temp[i]()/ 8 ] |= 1 << temp[i]()% 8 ;
110
110
int s = 0 ;
111
- while (used[s] )
111
+ while (used[s/ 8 ] & 1 << s% 8 )
112
112
++s;
113
113
return s;
114
114
}
You can’t perform that action at this time.
0 commit comments