diff options
author | Jan Huwald <jh@sotun.de> | 2013-06-04 09:40:43 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2013-06-04 09:40:43 (GMT) |
commit | f6e02882fb9899eca36d389ee55fdaf0ec5cc5b3 (patch) | |
tree | 95d6d0e83083194e72e141f3fe3cbcd441cc74e7 /cacount.cpp | |
parent | f06c74f26a3e3b9b6225c70fda283a97b0494919 (diff) |
go to 64-bit State, use bit-packed array
Diffstat (limited to 'cacount.cpp')
-rw-r--r-- | cacount.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cacount.cpp b/cacount.cpp index 3cd755c..8590eb0 100644 --- a/cacount.cpp +++ b/cacount.cpp @@ -13,15 +13,17 @@ #include <sys/mman.h> +#include "packed_array.hpp" + using namespace std; #ifndef BIT_WIDTH #define BIT_WIDTH 31 #endif -typedef uint32_t State; +typedef uint64_t State; const State logState = BIT_WIDTH; -const State maxState = 1 << logState; +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 @@ -40,12 +42,12 @@ State update(State s) { return r; } -typedef array<State, maxState> Trans; +typedef packed_array<State, maxState, BIT_WIDTH> Trans; void iterState(function<void(int)> f, bool parallel = false) { int numThreads=1; if (parallel) { - numThreads = min(thread::hardware_concurrency(), + numThreads = min((State) thread::hardware_concurrency(), maxState / maxWordSize); } list<thread*> tasks; @@ -87,7 +89,7 @@ void findCycle(Trans &t, Trans &c, bitset<maxState> &reachable) { iterState([&](int s) { c[s] = t[s]; }, true); iterTrans(logState, [&](int s) { - c[s] = min(c[s], c[t[s]]); + c[s] = min<State>(c[s], c[t[s]]); t[s] = t[t[s]]; }, (char*) "cycles: "); } |