我有一些数据以 32 位字的形式出现,它代表 32 个通道,可以触发或不触发。然后,我想获取这些数据并将通道单独添加为 int,以便我可以找出该通道已触发的多次。
例如对于 4 个通道:
001001 001000
会成为:
002001
到目前为止,我不断收到这种类型的错误:
error: no match for ‘operator=’ in ‘*(((std::vector<unsigned int, std::allocator<unsigned int> >*)(((long unsigned int)i) * 24ul)) + dat) = data2[i]’
关于如何帮助我的任何想法?谢谢 =)
void binary(int convert,vector <unsigned>* dat) {
bitset<32> bits(convert);
//cout << bits.to_string() << endl;
//cout << bits.to_ulong() << endl;
char data[32];
int data2[32];
for(unsigned i = 0; i < 32; ++i) {
data[i] = bits[i];
data2[i] = data[i];
dat[i] = data2[i]; ///ERROR WAS HERE
}
for(unsigned i = 32; i; --i) {
int j;
cout << (data2[i-1]);
}
cout << endl;
}
void SerDi() {
vector <unsigned> dat(32);
cout << " Reading data from memory..." << endl;
ValVector< uint32_t> data=hw.getNode("SerDi.RAM").readBlock(8);
hw.dispatch();
cout << data[0]<<endl;
cout << data[1]<<endl;
for (unsigned i = 2; i < 7; i++) {
binary(data[i], &dat);
}
//graph(dat);
}