From: Martin Mares Date: Tue, 30 Oct 2012 20:13:39 +0000 (+0100) Subject: Heap: Revert changes to HEAP_DELETE, which broke position tracking X-Git-Tag: v5.99~102 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=643dc4c0697865fbe124d814e736d64a456a5da2;p=libucw.git Heap: Revert changes to HEAP_DELETE, which broke position tracking --- 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) /**