Mise en commentaire d'un ASSERT qui faisait des accès mémoire non initialisés.
This commit is contained in:
parent
c8f30f064e
commit
e9326924f2
30
heap.cpp
30
heap.cpp
|
@ -6,14 +6,14 @@ Heap::Heap()
|
||||||
void Heap::init(int id, int factor) { this->id = id; this->factor = factor; }
|
void Heap::init(int id, int factor) { this->id = id; this->factor = factor; }
|
||||||
|
|
||||||
void Heap::insert(float key, Chose* value) {
|
void Heap::insert(float key, Chose* value) {
|
||||||
{ // DEBUG
|
// { // DEBUG
|
||||||
int _d_node = value->lod.heaps[id];
|
// int _d_node = value->lod.heaps[id];
|
||||||
if (_d_node <= lastNode && _d_node >= 0 &&
|
// if (_d_node <= lastNode && _d_node >= 0 &&
|
||||||
buckets[getBucket(_d_node)][getIndex(_d_node)].value == value) {
|
// buckets[getBucket(_d_node)][getIndex(_d_node)].value == value) {
|
||||||
std::cout << "ERROR ! Trying to insert " << value;
|
// std::cout << "ERROR ! Trying to insert " << value;
|
||||||
std::cout << " but it is already here." << std::endl;
|
// std::cout << " but it is already here." << std::endl;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
++lastNode;
|
++lastNode;
|
||||||
if (getBucket(lastNode) > lastAllocatedBucket) {
|
if (getBucket(lastNode) > lastAllocatedBucket) {
|
||||||
allocateBucket();
|
allocateBucket();
|
||||||
|
@ -26,13 +26,13 @@ void Heap::insert(float key, Chose* value) {
|
||||||
void Heap::remove(Chose* value) {
|
void Heap::remove(Chose* value) {
|
||||||
int node = value->lod.heaps[id];
|
int node = value->lod.heaps[id];
|
||||||
|
|
||||||
{ // DEBUG
|
// { // DEBUG
|
||||||
if (buckets[getBucket(node)][getIndex(node)].value != value) {
|
// if (buckets[getBucket(node)][getIndex(node)].value != value) {
|
||||||
std::cout << "ERROR ! Trying to remove " << value;
|
// std::cout << "ERROR ! Trying to remove " << value;
|
||||||
std::cout << " but found " << buckets[getBucket(node)][getIndex(node)].value;
|
// std::cout << " but found " << buckets[getBucket(node)][getIndex(node)].value;
|
||||||
std::cout << std::endl;
|
// std::cout << std::endl;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (node == lastNode) { // On a supprimé le dernier noeud.
|
if (node == lastNode) { // On a supprimé le dernier noeud.
|
||||||
--lastNode;
|
--lastNode;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user