diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-12-07 20:04:15 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-12-07 20:04:23 -0600 |
| commit | a7adc0af074826a4c68c7395d2abfd4b931955df (patch) | |
| tree | e9db6027bf690ad17e66a97334a52e7f8790d36f /tb/top/conspiracion.cpp | |
| parent | c39552375661e495b344e8386649ade92a4d45b2 (diff) | |
Make the cycle limit optional
Diffstat (limited to 'tb/top/conspiracion.cpp')
| -rw-r--r-- | tb/top/conspiracion.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tb/top/conspiracion.cpp b/tb/top/conspiracion.cpp index bd1086a..f222e54 100644 --- a/tb/top/conspiracion.cpp +++ b/tb/top/conspiracion.cpp @@ -1,3 +1,4 @@ +#include <climits> #include <cstdio> #include <cstdint> #include <cstdlib> @@ -204,7 +205,7 @@ int main(int argc, char **argv) args::ValueFlag<unsigned> cycles ( - parser, "cycles", "Number of core cycles to run", {"cycles"}, 256 + parser, "cycles", "Max number of core cycles to run", {"cycles"}, UINT_MAX ); args::ValueFlag<int> control_fd @@ -446,9 +447,10 @@ int main(int argc, char **argv) }; unsigned i = 0; - while(!failed && i < *cycles) + // Abuse unsigned overflow (cycles is UINT_MAX by default) + while(!failed && i + 1 <= *cycles) { - for(; i < *cycles; ++i) + for(; i + 1 <= *cycles; ++i) { cycle(); if(failed || top.cpu_halted) [[unlikely]] |
