]> git.ipfire.org Git - thirdparty/linux.git/commit - lib/test_min_heap.c
lib: Introduce generic min-heap
authorIan Rogers <irogers@google.com>
Fri, 14 Feb 2020 07:51:29 +0000 (23:51 -0800)
committerIngo Molnar <mingo@kernel.org>
Fri, 6 Mar 2020 10:56:59 +0000 (11:56 +0100)
commit6e24628d78e4785385876125cba62315ca3b04b9
tree4b59f1aa6c459cb20c31008bb93599d3731c4732
parent98add2af89bbfe8241e189b490fd91e5751c7900
lib: Introduce generic min-heap

Supports push, pop and converting an array into a heap. If the sense of
the compare function is inverted then it can provide a max-heap.

Based-on-work-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20200214075133.181299-3-irogers@google.com
include/linux/min_heap.h [new file with mode: 0644]
lib/Kconfig.debug
lib/Makefile
lib/test_min_heap.c [new file with mode: 0644]