xref: /linux/lib/min_heap.c (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/export.h>
3 #include <linux/min_heap.h>
4 
5 void __min_heap_init(min_heap_char *heap, void *data, int size)
6 {
7 	__min_heap_init_inline(heap, data, size);
8 }
9 EXPORT_SYMBOL(__min_heap_init);
10 
11 void *__min_heap_peek(struct min_heap_char *heap)
12 {
13 	return __min_heap_peek_inline(heap);
14 }
15 EXPORT_SYMBOL(__min_heap_peek);
16 
17 bool __min_heap_full(min_heap_char *heap)
18 {
19 	return __min_heap_full_inline(heap);
20 }
21 EXPORT_SYMBOL(__min_heap_full);
22 
23 void __min_heap_sift_down(min_heap_char *heap, int pos, size_t elem_size,
24 			  const struct min_heap_callbacks *func, void *args)
25 {
26 	__min_heap_sift_down_inline(heap, pos, elem_size, func, args);
27 }
28 EXPORT_SYMBOL(__min_heap_sift_down);
29 
30 void __min_heap_sift_up(min_heap_char *heap, size_t elem_size, size_t idx,
31 			const struct min_heap_callbacks *func, void *args)
32 {
33 	__min_heap_sift_up_inline(heap, elem_size, idx, func, args);
34 }
35 EXPORT_SYMBOL(__min_heap_sift_up);
36 
37 void __min_heapify_all(min_heap_char *heap, size_t elem_size,
38 		       const struct min_heap_callbacks *func, void *args)
39 {
40 	__min_heapify_all_inline(heap, elem_size, func, args);
41 }
42 EXPORT_SYMBOL(__min_heapify_all);
43 
44 bool __min_heap_pop(min_heap_char *heap, size_t elem_size,
45 		    const struct min_heap_callbacks *func, void *args)
46 {
47 	return __min_heap_pop_inline(heap, elem_size, func, args);
48 }
49 EXPORT_SYMBOL(__min_heap_pop);
50 
51 void __min_heap_pop_push(min_heap_char *heap, const void *element, size_t elem_size,
52 			 const struct min_heap_callbacks *func, void *args)
53 {
54 	__min_heap_pop_push_inline(heap, element, elem_size, func, args);
55 }
56 EXPORT_SYMBOL(__min_heap_pop_push);
57 
58 bool __min_heap_push(min_heap_char *heap, const void *element, size_t elem_size,
59 		     const struct min_heap_callbacks *func, void *args)
60 {
61 	return __min_heap_push_inline(heap, element, elem_size, func, args);
62 }
63 EXPORT_SYMBOL(__min_heap_push);
64 
65 bool __min_heap_del(min_heap_char *heap, size_t elem_size, size_t idx,
66 		    const struct min_heap_callbacks *func, void *args)
67 {
68 	return __min_heap_del_inline(heap, elem_size, idx, func, args);
69 }
70 EXPORT_SYMBOL(__min_heap_del);
71