fix
authorChristian Grothoff <christian@grothoff.org>
Wed, 23 Dec 2009 20:13:52 +0000 (20:13 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 23 Dec 2009 20:13:52 +0000 (20:13 +0000)
src/util/container_heap.c

index dbb391ac4e5e949feaf802af40993be7c9195f47..1bb7d579007f5573737cb46a40cf92da8a30e68a 100644 (file)
@@ -278,7 +278,9 @@ insert_node (struct GNUNET_CONTAINER_Heap *heap,
   struct GNUNET_CONTAINER_HeapNode *parent;
 
   GNUNET_assert (node->parent == NULL);
-  while ( (pos->cost < node->cost) ^ (heap->order == GNUNET_CONTAINER_HEAP_ORDER_MAX) )
+  while ( (heap->order == GNUNET_CONTAINER_HEAP_ORDER_MAX) 
+         ? (pos->cost >= node->cost) 
+         : (pos->cost <= node->cost) )
     {
       /* node is descendent of pos */
       pos->tree_size += (1 + node->tree_size);