Assign match result to volatile in benchmarks

This is needed to avoid the compiler eliding the call in
highly-optimised builds.
This commit is contained in:
Camden Dixie O'Brien 2024-11-10 16:28:38 +00:00
parent 97529fdd2b
commit 4131af3912

View File

@ -31,9 +31,11 @@ static void matching_benchmark(const fsa_t *fsa)
for (int j = 0; j < LEN; ++j) for (int j = 0; j < LEN; ++j)
s[j] = CLAMP_CHAR(rand()); s[j] = CLAMP_CHAR(rand());
volatile bool match;
START_CLOCK(); START_CLOCK();
fsa_accepts(fsa, s, LEN); match = fsa_accepts(fsa, s, LEN);
STOP_CLOCK(); STOP_CLOCK();
(void)match;
} }
int main(void) int main(void)