diff options
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: "); } |