Skip to content

Instantly share code, notes, and snippets.

@Izaron
Created August 22, 2018 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Izaron/5005fed4184ee6483699191dc5ef3677 to your computer and use it in GitHub Desktop.
Save Izaron/5005fed4184ee6483699191dc5ef3677 to your computer and use it in GitHub Desktop.
Measure the running time with `time ./test` on Linux
#include <iostream>
#include <boost/dynamic_bitset.hpp>
int maxn = 1e8;
int bits = 100;
void test1() {
boost::dynamic_bitset<> bs(bits, abs(rand()));
int a = 0;
for (int i = 0; i < maxn; i++) {
a += bs.count();
}
std::cout << a << std::endl;
}
int main() {
std::cout << boost::dynamic_bitset<>::bits_per_block << std::endl;
srand(time(NULL));
test1();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment