diff options
Diffstat (limited to 'cacount.cpp')
-rw-r--r-- | cacount.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/cacount.cpp b/cacount.cpp index 7abda2f..1437c66 100644 --- a/cacount.cpp +++ b/cacount.cpp @@ -10,9 +10,9 @@ #include <map> #include <set> #include <thread> +#include <boost/integer.hpp> #include "mmalloc.hpp" -#include "packed_array.hpp" #include "timer.hpp" using namespace std; @@ -22,15 +22,10 @@ using boost::optional; #define BIT_WIDTH 30 #endif -typedef uint64_t State; +typedef typename boost::uint_t<BIT_WIDTH + 1>::least State; const State logState = BIT_WIDTH; const State maxState = (State) 1 << logState; -// # of bits of largest memory fetch issued; machine-specific; used to -// garantue that sub-byte sized access of different threads never -// address the same word -const uint maxWordSize = 128; - bitset<8> rule(110); State update(State s) { @@ -43,15 +38,14 @@ State update(State s) { return r; } -typedef packed_array<State, maxState, BIT_WIDTH> Trans; -typedef packed_array<bool, maxState, 1> pbitset; +typedef array<State, maxState> Trans; +typedef array<uint8_t, maxState> pbitset; void iterState(function<void(int)> f, optional<string> msg = optional<string>(), bool parallel = false) { PerfPrinter perfPrinter(msg); int numThreads=1; if (parallel) { - numThreads = min((State) thread::hardware_concurrency(), - maxState / maxWordSize); + numThreads = min((State) thread::hardware_concurrency(), maxState); } list<thread*> tasks; for (int t=0; t<numThreads; t++) { @@ -175,7 +169,7 @@ int main(int argc, char **argv) { if (!strcmp(argv[2], "cycle")) { Trans *t = mmalloc<Trans>(), *c = mmalloc<Trans>(); - packed_array<bool, maxState, 1> *r = mmalloc<packed_array<bool, maxState, 1>>(); + pbitset *r = mmalloc<pbitset>(); init(*t); findCycle(*t, *c, *r); cycleStat(*c, *r); |