Skip to content

Commit 4253b5b

Browse files
authored
Refactor xor_basis to use fixed size of 30
1 parent 36932a2 commit 4253b5b

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

tests/library_checker_aizu_tests/math/xor_basis_intersection.test.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ void check_condition_unordered(const basis& b) {
1414
or_bits |= b.b[i];
1515
}
1616
}
17-
const int B = 30;
18-
void check_condition_ordered(const xor_basis<B>& basis2) {
19-
bitset<B> or_bits2;
20-
for (int i = 0; i < B; i++) {
17+
void check_condition_ordered(const xor_basis<30>& basis2) {
18+
bitset<30> or_bits2;
19+
for (int i = 0; i < 30; i++) {
2120
assert(basis2.basis[i].none() ||
2221
bit_floor(basis2.basis[i].to_ulong()) ==
2322
(1ULL << i));
@@ -34,13 +33,13 @@ int main() {
3433
int n;
3534
cin >> n;
3635
basis basis1;
37-
xor_basis<B> basis2;
38-
for (int i = 0; i < B; i++)
36+
xor_basis<30> basis2;
37+
for (int i = 0; i < 30; i++)
3938
assert(basis2.basis[i].none());
4039
for (int i = 0; i < n; i++) {
4140
int val;
4241
cin >> val;
43-
bitset<B> v = val;
42+
bitset<30> v = val;
4443
assert(basis1.insert(val));
4544
assert(!basis1.insert(val));
4645
assert(basis2.insert(v));
@@ -51,11 +50,11 @@ int main() {
5150
int m;
5251
cin >> m;
5352
basis basis3;
54-
xor_basis<B> basis4;
53+
xor_basis<30> basis4;
5554
for (int j = 0; j < m; j++) {
5655
int val;
5756
cin >> val;
58-
bitset<B> v = val;
57+
bitset<30> v = val;
5958
assert(basis3.insert(val));
6059
assert(!basis3.insert(val));
6160
assert(basis4.insert(v));

0 commit comments

Comments
 (0)