Add flags to gcc invocations
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
parent
7775028b58
commit
e2db3a7748
@ -17,11 +17,11 @@ steps:
|
|||||||
image: gcc:12.2.0
|
image: gcc:12.2.0
|
||||||
commands:
|
commands:
|
||||||
- cd algo2/pairingheap
|
- cd algo2/pairingheap
|
||||||
- gcc -o main pairingheap.c
|
- gcc -Wall -Werror -o main pairingheap.c
|
||||||
- ./main
|
- ./main
|
||||||
- name: radixheap
|
- name: radixheap
|
||||||
image: gcc:12.2.0
|
image: gcc:12.2.0
|
||||||
commands:
|
commands:
|
||||||
- cd algo2/radixheap
|
- cd algo2/radixheap
|
||||||
- gcc -o main radixheap.c
|
- gcc -Wall -Werror -o main radixheap.c
|
||||||
- ./main
|
- ./main
|
||||||
|
@ -51,12 +51,12 @@ struct RHeap {
|
|||||||
struct RHeapNode *buckets;
|
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);
|
return 8 * sizeof(unsigned int) - __builtin_clz(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rh_init(struct RHeap *rh, unsigned int c) {
|
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->min = 0;
|
||||||
rh->buckets_size = 1 + k; // extra space for bucket -1
|
rh->buckets_size = 1 + k; // extra space for bucket -1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user