#include "registers.h"
#include <bits/stdc++.h>
using namespace std;
void compare(int al, int ar, int bl, int br) {
vector<bool> anding(2000, false);
for (int i = al; i < ar; ++i) {
anding[i] = true;
}
append_store(1, anding);
for (int i = al; i < ar; ++i) {
anding[i] = false;
}
for (int i = bl; i < br; ++i) {
anding[i] = true;
}
append_store(2, anding);
append_and(1, 0, 1);
append_and(2, 0, 2);
append_right(1, 1, al);
append_right(2, 2, bl);
append_not(3, 1);
append_add(3, 2, 3);
append_not(4, 2);
append_add(4, 1, 4);
append_right(3, 3, 1000);
append_right(4, 4, 1000);
append_and(3, 2, 3);
append_and(4, 1, 4);
}
void set(int al, int ar) {
int bl = 0, br = ar - al;
vector<bool> anding(2000, false);
for (int i = al; i < ar; ++i) {
anding[i] = true;
}
append_store(1, anding);
for (int i = al; i < ar; ++i) {
anding[i] = false;
}
append_and(1, 0, 1);
append_right(1, 1, al);
append_not(3, 1);
append_not(4, 99);
append_add(3, 99, 3);
append_add(4, 1, 4);
append_right(3, 3, 1000);
append_right(4, 4, 1000);
append_and(3, 99, 3);
append_and(4, 1, 4);
append_store(99, anding);
append_or(99, 99, 3);
append_or(99, 99, 4);
}
void construct_instructions(int s, int n, int k, int q) {
vector<bool> anding(2000, false);
if (s == 0) {
for (int i = 0; i < k; ++i) {
anding[i] = true;
}
append_store(99, anding);
append_and(99, 0, 99);
for (int i = 1; i < n; ++i) {
set(i * k, i * k + k);
}
append_move(0, 99);
} else {
}
}
Compilation message
registers.cpp: In function 'void set(int, int)':
registers.cpp:33:6: warning: unused variable 'bl' [-Wunused-variable]
33 | int bl = 0, br = ar - al;
| ^~
registers.cpp:33:14: warning: unused variable 'br' [-Wunused-variable]
33 | int bl = 0, br = ar - al;
| ^~
registers.cpp: In function 'void construct_instructions(int, int, int, int)':
registers.cpp:66:4: error: reference to 'set' is ambiguous
66 | set(i * k, i * k + k);
| ^~~
In file included from /usr/include/c++/10/set:61,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
from registers.cpp:2:
/usr/include/c++/10/bits/stl_set.h:94:11: note: candidates are: 'template<class _Key, class _Compare, class _Alloc> class std::set'
94 | class set
| ^~~
registers.cpp:32:6: note: 'void set(int, int)'
32 | void set(int al, int ar) {
| ^~~