X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Flib%2Fsort.qh;h=cd0000912dfcfb65b715bcfabebf889d29144adc;hb=b8880819e333ef558143ae80afcdb339b907a439;hp=565ebb29c81513276a8f49334cfebd2589cb0986;hpb=67410278136b3bf6c5437027ab2f39d0da49753c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/lib/sort.qh b/qcsrc/lib/sort.qh index 565ebb29c..cd0000912 100644 --- a/qcsrc/lib/sort.qh +++ b/qcsrc/lib/sort.qh @@ -10,16 +10,14 @@ void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass) { #define heapify(_count) \ MACRO_BEGIN \ - { \ for (int start = floor(((_count) - 2) / 2); start >= 0; --start) \ { \ siftdown(start, (_count) - 1); \ } \ - } MACRO_END + MACRO_END #define siftdown(_start, _end) \ MACRO_BEGIN \ - { \ for (int root = (_start); root * 2 + 1 <= (_end); ) \ { \ int child = root * 2 + 1; \ @@ -28,7 +26,7 @@ void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass) swap(root, child, pass); \ root = child; \ } \ - } MACRO_END + MACRO_END heapify(n); int end = n - 1;