From 643dc4c0697865fbe124d814e736d64a456a5da2 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 30 Oct 2012 21:13:39 +0100 Subject: [PATCH] Heap: Revert changes to HEAP_DELETE, which broke position tracking --- ucw/heap.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ucw/heap.h b/ucw/heap.h index ec8f4f3a..ad560af4 100644 --- a/ucw/heap.h +++ b/ucw/heap.h @@ -163,8 +163,15 @@ **/ #define HEAP_DELETE(type,heap,num,less,swap,pos) \ do { \ + uns _j, _l, _u; \ + type x; \ + _j = pos; \ + swap(heap,_j,num,x); \ num--; \ - HEAP_REPLACE(type,heap,num,less,swap,pos,heap[num+1]); \ + if (less(heap[_j], heap[num+1])) \ + HEAP_BUBBLE_UP_J(heap,num,less,swap) \ + else \ + HEAP_BUBBLE_DOWN_J(heap,num,less,swap); \ } while(0) /** -- 2.39.2