I have a bunch of bitsets<32> as global variables in my program and I want to update them after passing a pointer to one of them to a function.
Here is an example:
#include<bits/stdc++.h>
using namespace std;
bitset<32> zero(0);
bitset<32> ra(0);
bitset<32> sp;
bitset<32> gp;
bitset<32> tp(0);
bitset<32> t0(0);
bitset<32> t1(0);
void LUI(bitset<32>*rd, int imm){
bitset<32> temp(imm);
for(int i=31; i>=12; i--){
*rd[i]=temp[i];
}
for(int i=11; i>=0; i--){
*rd[i]=0;
}
}
How can I update for example t1 through the function LUI() as dereferencing is not working? Here are the errors I get:
error: no match for 'operator*' (operand type is 'std::bitset<32>')
46 | *rd[i]=0;
note: candidate expects 2 arguments, 1 provided
46 | *rd[i]=0;