URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 157 |
Rev 225 |
Line 212... |
Line 212... |
okey = node->key;
|
okey = node->key;
|
node->data = data;
|
node->data = data;
|
node->key = key;
|
node->key = key;
|
y = node->parent;
|
y = node->parent;
|
|
|
if (okey == key)
|
/* Short-circuit if the key is the same, as we then don't have to
|
|
do anything. Except if we're trying to force the new node to
|
|
be the new minimum for delete. */
|
|
if (okey == key && okey != FIBHEAPKEY_MIN)
|
return odata;
|
return odata;
|
|
|
/* These two compares are specifically <= 0 to make sure that in the case
|
/* These two compares are specifically <= 0 to make sure that in the case
|
of equality, a node we replaced the data on, becomes the new min. This
|
of equality, a node we replaced the data on, becomes the new min. This
|
is needed so that delete's call to extractmin gets the right node. */
|
is needed so that delete's call to extractmin gets the right node. */
|
Line 254... |
Line 257... |
{
|
{
|
void *ret = node->data;
|
void *ret = node->data;
|
|
|
/* To perform delete, we just make it the min key, and extract. */
|
/* To perform delete, we just make it the min key, and extract. */
|
fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
|
fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
|
|
if (node != heap->min)
|
|
{
|
|
fprintf (stderr, "Can't force minimum on fibheap.\n");
|
|
abort ();
|
|
}
|
fibheap_extract_min (heap);
|
fibheap_extract_min (heap);
|
|
|
return ret;
|
return ret;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.