diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-04-19 13:29:04 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-04-19 13:29:04 -0400 |
| commit | 3b0dce04a08d864626f841383727fbdab339ec83 (patch) | |
| tree | c466e7104ff75c76394fd4796cb0752b4f2c6a13 /builtins/array.h | |
| parent | 072bd523b97aacaf8639dd89a49f0c1a16d1d405 (diff) | |
Add heapify(), heap_push(), and heap_pop()
Diffstat (limited to 'builtins/array.h')
| -rw-r--r-- | builtins/array.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/builtins/array.h b/builtins/array.h index 711b89c4..a2c100d5 100644 --- a/builtins/array.h +++ b/builtins/array.h @@ -71,5 +71,10 @@ uint32_t Array$hash(const array_t *arr, const TypeInfo *type); int32_t Array$compare(const array_t *x, const array_t *y, const TypeInfo *type); bool Array$equal(const array_t *x, const array_t *y, const TypeInfo *type); CORD Array$as_text(const array_t *arr, bool colorize, const TypeInfo *type); +void Array$heapify(array_t *heap, closure_t comparison, const TypeInfo *type); +void Array$heap_push(array_t *heap, const void *item, closure_t comparison, const TypeInfo *type); +#define Array$heap_push_value(heap, _value, comparison, typeinfo) ({ __typeof(_value) value = _value; Array$heap_push(heap, &value, comparison, typeinfo); }) +void Array$heap_pop(array_t *heap, void *out, closure_t comparison, const TypeInfo *type); +#define Array$heap_pop_value(heap, comparison, typeinfo, type) ({ type value; Array$heap_pop(heap, &value, comparison, typeinfo); value; }) // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 |
