E
Eric.Medlin
I am reading in 1bit data to a buffer that contains over 30000 bits and
I would like to beable to bitshift the entire buffer and AND and OR it
with other buffers of the same size. I though I could use the stl
bitset class, but I cannot find a way to load the buffer into the
bitset. I have been trying with this test program (with the size
scaled down to 1024 bits) to load a buffer into the bitset, but prints
out all zeros.
#include <iostream>
#include <bitset>
int main(){
int const size = 1024;
unsigned char* data = new unsigned char[size];
*(data+1000) = 0xEA;
std::bitset<size> bits(*data);
std::cout<<bits.count()<<std::endl;
std::cout<<bits<<std::endl;
delete[] data;
return 0;
}
I would like to beable to bitshift the entire buffer and AND and OR it
with other buffers of the same size. I though I could use the stl
bitset class, but I cannot find a way to load the buffer into the
bitset. I have been trying with this test program (with the size
scaled down to 1024 bits) to load a buffer into the bitset, but prints
out all zeros.
#include <iostream>
#include <bitset>
int main(){
int const size = 1024;
unsigned char* data = new unsigned char[size];
*(data+1000) = 0xEA;
std::bitset<size> bits(*data);
std::cout<<bits.count()<<std::endl;
std::cout<<bits<<std::endl;
delete[] data;
return 0;
}