From bd9178a0ad5626544d6a70e8438680bb21db97b0 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Thu, 1 Oct 2020 23:10:31 +0200 Subject: Renamed cpqueue build() to make_heap() --- examples/heap.c | 2 +- examples/inits.c | 2 +- stc/cpqueue.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/heap.c b/examples/heap.c index e1225027..bca5f2e7 100644 --- a/examples/heap.c +++ b/examples/heap.c @@ -20,7 +20,7 @@ int main() c_forrange (i, int, N) cvec_f_push_back(&pq, (float) crand_i32(&pcg)); - cpqueue_f_build(&pq); + cpqueue_f_make_heap(&pq); printf("Built priority queue: %f secs\n", (clock() - start) / (float) CLOCKS_PER_SEC); c_forrange (i, int, M) diff --git a/examples/inits.c b/examples/inits.c index 26a05a51..ea4c61bc 100644 --- a/examples/inits.c +++ b/examples/inits.c @@ -31,7 +31,7 @@ int main(void) // CVEC PRIORITY QUEUE - cpqueue_f_build(&floats); // make heap + cpqueue_f_make_heap(&floats); c_push_items(&floats, cpqueue_f, {40.0f, 20.0f, 50.0f, 30.0f, 10.0f}); // sorted: diff --git a/stc/cpqueue.h b/stc/cpqueue.h index 92121dfc..19e225a9 100644 --- a/stc/cpqueue.h +++ b/stc/cpqueue.h @@ -65,7 +65,7 @@ STC_INLINE void \ cpqueue_##X##_del(cpqueue_##X* self) {ctype##_del(self);} \ STC_API void \ - cpqueue_##X##_build(cpqueue_##X* self); \ + cpqueue_##X##_make_heap(cpqueue_##X* self); \ STC_API void \ cpqueue_##X##_erase(cpqueue_##X* self, size_t i); \ STC_INLINE const cpqueue_##X##_value_t* \ @@ -103,7 +103,7 @@ } \ \ STC_API void \ - cpqueue_##X##_build(cpqueue_##X* self) { \ + cpqueue_##X##_make_heap(cpqueue_##X* self) { \ size_t n = cpqueue_##X##_size(*self); \ cpqueue_##X##_value_t *arr = self->data - 1; \ for (size_t k = n >> 1; k != 0; --k) \ -- cgit v1.2.3