From dc3f7eed4d9fd279cbeeef591f4ab29f4b1c025e Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 29 Nov 2023 21:46:44 +0000 Subject: [PATCH] run formatter in quickselect --- scratchpad/quickselect/makefile | 6 ++ scratchpad/quickselect/quickselect.c | 107 ++++++++++++++------------- 2 files changed, 62 insertions(+), 51 deletions(-) diff --git a/scratchpad/quickselect/makefile b/scratchpad/quickselect/makefile index c755523..5bc70f0 100644 --- a/scratchpad/quickselect/makefile +++ b/scratchpad/quickselect/makefile @@ -3,3 +3,9 @@ build: run: ./quickselect + +## Formatter +STYLE_BLUEPRINT=webkit +FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) +format: + $(FORMATTER) quickselect.c diff --git a/scratchpad/quickselect/quickselect.c b/scratchpad/quickselect/quickselect.c index 7bdb960..6ddc4c2 100644 --- a/scratchpad/quickselect/quickselect.c +++ b/scratchpad/quickselect/quickselect.c @@ -2,63 +2,68 @@ #include #include -void swp(int i, int j, double xs[]){ - double tmp = xs[i]; - xs[i] = xs[j]; - xs[j] = tmp; +void swp(int i, int j, double xs[]) +{ + double tmp = xs[i]; + xs[i] = xs[j]; + xs[j] = tmp; } -void array_print(double xs[], int n){ - printf("["); - for(int i=0; i