From 75fdb1260b399099d79459cb3c07ac1d151ffb65 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 18 Apr 2024 17:20:50 +0200 Subject: [PATCH] fix benchmark? --- src/quicksort.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/quicksort.c b/src/quicksort.c index 03c0899..8bb2883 100644 --- a/src/quicksort.c +++ b/src/quicksort.c @@ -99,21 +99,22 @@ int benchmark(int argc, char **argv) { break; case 'n': n = atoi(optarg); - if (n <= 0) { - goto usage; - } break; case 't': nthreads = atoi(optarg); - if (nthreads <= 0) { - goto usage; - } break; default: goto usage; } } + if (n <= 0) { + goto usage; + } + if (nthreads < 0 && !serial) { + goto usage; + } + a = malloc(n * sizeof(int)); unsigned long long s = 0;