diff options
Diffstat (limited to 'lib/BinHeap.cc')
-rw-r--r-- | lib/BinHeap.cc | 9 |
1 files changed, 7 insertions, 2 deletions
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; } |