From e2db3a774861011b3ba0e3850852aea8ce95b4f2 Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Wed, 14 Sep 2022 17:43:22 +0200 Subject: [PATCH] Add flags to gcc invocations --- .drone.yml | 4 ++-- algo2/radixheap/radixheap.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index b42062a..8cfeaf6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,11 +17,11 @@ steps: image: gcc:12.2.0 commands: - cd algo2/pairingheap - - gcc -o main pairingheap.c + - gcc -Wall -Werror -o main pairingheap.c - ./main - name: radixheap image: gcc:12.2.0 commands: - cd algo2/radixheap - - gcc -o main radixheap.c + - gcc -Wall -Werror -o main radixheap.c - ./main diff --git a/algo2/radixheap/radixheap.c b/algo2/radixheap/radixheap.c index d4b5b47..693d031 100644 --- a/algo2/radixheap/radixheap.c +++ b/algo2/radixheap/radixheap.c @@ -51,12 +51,12 @@ struct RHeap { struct RHeapNode *buckets; }; -static unsigned int log2(unsigned int x) { +static unsigned int uintlog2(unsigned int x) { return 8 * sizeof(unsigned int) - __builtin_clz(x); } void rh_init(struct RHeap *rh, unsigned int c) { - unsigned int k = 1 + log2(c); + unsigned int k = 1 + uintlog2(c); rh->min = 0; rh->buckets_size = 1 + k; // extra space for bucket -1