From 9bf8629e1420fb0bc09103e747f7d9b18aa7f10d Mon Sep 17 00:00:00 2001 From: Pixel <> Date: Wed, 21 Mar 2001 09:13:34 +0000 Subject: Bug fixes --- lib/BinHeap.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/BinHeap.cc') diff --git a/lib/BinHeap.cc b/lib/BinHeap.cc index 450ff4a..b57a31d 100644 --- a/lib/BinHeap.cc +++ b/lib/BinHeap.cc @@ -80,6 +80,7 @@ BinHeap::~BinHeap(void) Key_t BinHeap::ReadKey(Cell C) { + cerr << "Lecture de " << C << endl; return ((binheap_t *) FP->ReadDatas(C))->Key; } @@ -123,6 +124,7 @@ Cell BinHeap::Insert(Key_t IKey, Datas_t const &IDatas) { binheap_t newcell = { IKey, IDatas }, *binheap; int i = Key++; + Cell r; if (!Datas || ((((Key >> GRANUL) + 1) << GRANUL) != (((i >> GRANUL) + 1) << GRANUL))) { if (!(Datas = realloc(Datas, (((Key >> GRANUL) + 1) << GRANUL) * sizeof(binheap_t)))) { @@ -135,11 +137,14 @@ Cell BinHeap::Insert(Key_t IKey, Datas_t const &IDatas) while ((i > 1) && (binheap[FATHER(i) - 1].Key > IKey)) { binheap[i - 1] = binheap[FATHER(i) - 1]; + ((CList *) binheap[FATHER(i) - 1].FP)->Datas = &binheap[i - 1]; i = FATHER(i); } binheap[i - 1] = newcell; - - return (binheap[i - 1].FP = FP->Insert(0, &(binheap[i - 1]))); + + r = binheap[i - 1].FP = FP->Insert(0, &(binheap[i - 1])); + cerr << "Ajout de " << r << endl; + return r; } -- cgit v1.2.3