Skip to content

Commit 1d4657f

Browse files
committed
remove one precalc dimension
1 parent 2153a8e commit 1d4657f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

verify/structures/bitpack/prod_mod_2.test.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ using cp_algo::structures::bitpack;
1212
const int maxn = 1 << 12;
1313
bitpack<maxn> a[maxn], b[maxn], c[maxn];
1414
const int K = 8;
15-
bitpack<maxn> precalc[maxn / K][1 << K];
15+
bitpack<maxn> precalc[1 << K];
1616

17-
void process_precalc() {
18-
for(int i = 0; i < maxn / K; i++) {
19-
for(int j = 0; j < K; j++) {
20-
int step = 1 << j;
21-
for(int k = 0; k < step; k++) {
22-
precalc[i][k + step] = precalc[i][k] ^ b[K * i + j];
23-
}
17+
void process_precalc(int i) {
18+
for(auto &it: precalc) {
19+
it = bitpack<maxn>();
20+
}
21+
for(int j = 0; j < K; j++) {
22+
int step = 1 << j;
23+
for(int k = 0; k < step; k++) {
24+
precalc[k + step] = precalc[k] ^ b[K * i + j];
2425
}
2526
}
2627
}
@@ -39,12 +40,11 @@ void solve() {
3940
b[i] = row;
4041
}
4142
cp_algo::checkpoint("read");
42-
process_precalc();
43-
cp_algo::checkpoint("precalc");
4443
for(int j = 0; j < m; j += 64) {
4544
for(int z = 0; z < 64 / K; z++) {
45+
process_precalc(j / K + z);
4646
for(int i = 0; i < n; i++) {
47-
c[i] ^= precalc[j / K + z][uint8_t(a[i].word(j / 64) >> K * z)];
47+
c[i] ^= precalc[uint8_t(a[i].word(j / 64) >> K * z)];
4848
}
4949
}
5050
}

0 commit comments

Comments
 (0)