diff options
author | Pixel <> | 2001-03-21 09:13:34 +0000 |
---|---|---|
committer | Pixel <> | 2001-03-21 09:13:34 +0000 |
commit | 9bf8629e1420fb0bc09103e747f7d9b18aa7f10d (patch) | |
tree | 22a20f7d1c9c00db9a8970df40d0a981517d2a96 /lib/BinHeap.cc | |
parent | 68332dfa57850ceabed4c270638096edf2bc32e7 (diff) |
Bug fixes
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; } |