OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [libiberty/] [fibheap.c] - Diff between revs 156 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 156 Rev 816
/* A Fibonacci heap datatype.
/* A Fibonacci heap datatype.
   Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
   Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
   Contributed by Daniel Berlin (dan@cgsoftware.com).
   Contributed by Daniel Berlin (dan@cgsoftware.com).
 
 
This file is part of GNU CC.
This file is part of GNU CC.
 
 
GNU CC is free software; you can redistribute it and/or modify it
GNU CC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
the Free Software Foundation; either version 2, or (at your option)
any later version.
any later version.
 
 
GNU CC is distributed in the hope that it will be useful, but
GNU CC is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
General Public License for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING.  If not, write to
along with GNU CC; see the file COPYING.  If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA.  */
Boston, MA 02110-1301, USA.  */
 
 
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "config.h"
#endif
#endif
#ifdef HAVE_LIMITS_H
#ifdef HAVE_LIMITS_H
#include <limits.h>
#include <limits.h>
#endif
#endif
#ifdef HAVE_STDLIB_H
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#include <stdlib.h>
#endif
#endif
#ifdef HAVE_STRING_H
#ifdef HAVE_STRING_H
#include <string.h>
#include <string.h>
#endif
#endif
#include "libiberty.h"
#include "libiberty.h"
#include "fibheap.h"
#include "fibheap.h"
 
 
 
 
#define FIBHEAPKEY_MIN  LONG_MIN
#define FIBHEAPKEY_MIN  LONG_MIN
 
 
static void fibheap_ins_root (fibheap_t, fibnode_t);
static void fibheap_ins_root (fibheap_t, fibnode_t);
static void fibheap_rem_root (fibheap_t, fibnode_t);
static void fibheap_rem_root (fibheap_t, fibnode_t);
static void fibheap_consolidate (fibheap_t);
static void fibheap_consolidate (fibheap_t);
static void fibheap_link (fibheap_t, fibnode_t, fibnode_t);
static void fibheap_link (fibheap_t, fibnode_t, fibnode_t);
static void fibheap_cut (fibheap_t, fibnode_t, fibnode_t);
static void fibheap_cut (fibheap_t, fibnode_t, fibnode_t);
static void fibheap_cascading_cut (fibheap_t, fibnode_t);
static void fibheap_cascading_cut (fibheap_t, fibnode_t);
static fibnode_t fibheap_extr_min_node (fibheap_t);
static fibnode_t fibheap_extr_min_node (fibheap_t);
static int fibheap_compare (fibheap_t, fibnode_t, fibnode_t);
static int fibheap_compare (fibheap_t, fibnode_t, fibnode_t);
static int fibheap_comp_data (fibheap_t, fibheapkey_t, void *, fibnode_t);
static int fibheap_comp_data (fibheap_t, fibheapkey_t, void *, fibnode_t);
static fibnode_t fibnode_new (void);
static fibnode_t fibnode_new (void);
static void fibnode_insert_after (fibnode_t, fibnode_t);
static void fibnode_insert_after (fibnode_t, fibnode_t);
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
#define fibnode_insert_before(a, b) fibnode_insert_after (a->left, b)
static fibnode_t fibnode_remove (fibnode_t);
static fibnode_t fibnode_remove (fibnode_t);
 
 


/* Create a new fibonacci heap.  */
/* Create a new fibonacci heap.  */
fibheap_t
fibheap_t
fibheap_new (void)
fibheap_new (void)
{
{
  return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
  return (fibheap_t) xcalloc (1, sizeof (struct fibheap));
}
}
 
 
/* Create a new fibonacci heap node.  */
/* Create a new fibonacci heap node.  */
static fibnode_t
static fibnode_t
fibnode_new (void)
fibnode_new (void)
{
{
  fibnode_t node;
  fibnode_t node;
 
 
  node = (fibnode_t) xcalloc (1, sizeof *node);
  node = (fibnode_t) xcalloc (1, sizeof *node);
  node->left = node;
  node->left = node;
  node->right = node;
  node->right = node;
 
 
  return node;
  return node;
}
}
 
 
static inline int
static inline int
fibheap_compare (fibheap_t heap ATTRIBUTE_UNUSED, fibnode_t a, fibnode_t b)
fibheap_compare (fibheap_t heap ATTRIBUTE_UNUSED, fibnode_t a, fibnode_t b)
{
{
  if (a->key < b->key)
  if (a->key < b->key)
    return -1;
    return -1;
  if (a->key > b->key)
  if (a->key > b->key)
    return 1;
    return 1;
  return 0;
  return 0;
}
}
 
 
static inline int
static inline int
fibheap_comp_data (fibheap_t heap, fibheapkey_t key, void *data, fibnode_t b)
fibheap_comp_data (fibheap_t heap, fibheapkey_t key, void *data, fibnode_t b)
{
{
  struct fibnode a;
  struct fibnode a;
 
 
  a.key = key;
  a.key = key;
  a.data = data;
  a.data = data;
 
 
  return fibheap_compare (heap, &a, b);
  return fibheap_compare (heap, &a, b);
}
}
 
 
/* Insert DATA, with priority KEY, into HEAP.  */
/* Insert DATA, with priority KEY, into HEAP.  */
fibnode_t
fibnode_t
fibheap_insert (fibheap_t heap, fibheapkey_t key, void *data)
fibheap_insert (fibheap_t heap, fibheapkey_t key, void *data)
{
{
  fibnode_t node;
  fibnode_t node;
 
 
  /* Create the new node.  */
  /* Create the new node.  */
  node = fibnode_new ();
  node = fibnode_new ();
 
 
  /* Set the node's data.  */
  /* Set the node's data.  */
  node->data = data;
  node->data = data;
  node->key = key;
  node->key = key;
 
 
  /* Insert it into the root list.  */
  /* Insert it into the root list.  */
  fibheap_ins_root (heap, node);
  fibheap_ins_root (heap, node);
 
 
  /* If their was no minimum, or this key is less than the min,
  /* If their was no minimum, or this key is less than the min,
     it's the new min.  */
     it's the new min.  */
  if (heap->min == NULL || node->key < heap->min->key)
  if (heap->min == NULL || node->key < heap->min->key)
    heap->min = node;
    heap->min = node;
 
 
  heap->nodes++;
  heap->nodes++;
 
 
  return node;
  return node;
}
}
 
 
/* Return the data of the minimum node (if we know it).  */
/* Return the data of the minimum node (if we know it).  */
void *
void *
fibheap_min (fibheap_t heap)
fibheap_min (fibheap_t heap)
{
{
  /* If there is no min, we can't easily return it.  */
  /* If there is no min, we can't easily return it.  */
  if (heap->min == NULL)
  if (heap->min == NULL)
    return NULL;
    return NULL;
  return heap->min->data;
  return heap->min->data;
}
}
 
 
/* Return the key of the minimum node (if we know it).  */
/* Return the key of the minimum node (if we know it).  */
fibheapkey_t
fibheapkey_t
fibheap_min_key (fibheap_t heap)
fibheap_min_key (fibheap_t heap)
{
{
  /* If there is no min, we can't easily return it.  */
  /* If there is no min, we can't easily return it.  */
  if (heap->min == NULL)
  if (heap->min == NULL)
    return 0;
    return 0;
  return heap->min->key;
  return heap->min->key;
}
}
 
 
/* Union HEAPA and HEAPB into a new heap.  */
/* Union HEAPA and HEAPB into a new heap.  */
fibheap_t
fibheap_t
fibheap_union (fibheap_t heapa, fibheap_t heapb)
fibheap_union (fibheap_t heapa, fibheap_t heapb)
{
{
  fibnode_t a_root, b_root, temp;
  fibnode_t a_root, b_root, temp;
 
 
  /* If one of the heaps is empty, the union is just the other heap.  */
  /* If one of the heaps is empty, the union is just the other heap.  */
  if ((a_root = heapa->root) == NULL)
  if ((a_root = heapa->root) == NULL)
    {
    {
      free (heapa);
      free (heapa);
      return heapb;
      return heapb;
    }
    }
  if ((b_root = heapb->root) == NULL)
  if ((b_root = heapb->root) == NULL)
    {
    {
      free (heapb);
      free (heapb);
      return heapa;
      return heapa;
    }
    }
 
 
  /* Merge them to the next nodes on the opposite chain.  */
  /* Merge them to the next nodes on the opposite chain.  */
  a_root->left->right = b_root;
  a_root->left->right = b_root;
  b_root->left->right = a_root;
  b_root->left->right = a_root;
  temp = a_root->left;
  temp = a_root->left;
  a_root->left = b_root->left;
  a_root->left = b_root->left;
  b_root->left = temp;
  b_root->left = temp;
  heapa->nodes += heapb->nodes;
  heapa->nodes += heapb->nodes;
 
 
  /* And set the new minimum, if it's changed.  */
  /* And set the new minimum, if it's changed.  */
  if (fibheap_compare (heapa, heapb->min, heapa->min) < 0)
  if (fibheap_compare (heapa, heapb->min, heapa->min) < 0)
    heapa->min = heapb->min;
    heapa->min = heapb->min;
 
 
  free (heapb);
  free (heapb);
  return heapa;
  return heapa;
}
}
 
 
/* Extract the data of the minimum node from HEAP.  */
/* Extract the data of the minimum node from HEAP.  */
void *
void *
fibheap_extract_min (fibheap_t heap)
fibheap_extract_min (fibheap_t heap)
{
{
  fibnode_t z;
  fibnode_t z;
  void *ret = NULL;
  void *ret = NULL;
 
 
  /* If we don't have a min set, it means we have no nodes.  */
  /* If we don't have a min set, it means we have no nodes.  */
  if (heap->min != NULL)
  if (heap->min != NULL)
    {
    {
      /* Otherwise, extract the min node, free the node, and return the
      /* Otherwise, extract the min node, free the node, and return the
         node's data.  */
         node's data.  */
      z = fibheap_extr_min_node (heap);
      z = fibheap_extr_min_node (heap);
      ret = z->data;
      ret = z->data;
      free (z);
      free (z);
    }
    }
 
 
  return ret;
  return ret;
}
}
 
 
/* Replace both the KEY and the DATA associated with NODE.  */
/* Replace both the KEY and the DATA associated with NODE.  */
void *
void *
fibheap_replace_key_data (fibheap_t heap, fibnode_t node,
fibheap_replace_key_data (fibheap_t heap, fibnode_t node,
                          fibheapkey_t key, void *data)
                          fibheapkey_t key, void *data)
{
{
  void *odata;
  void *odata;
  fibheapkey_t okey;
  fibheapkey_t okey;
  fibnode_t y;
  fibnode_t y;
 
 
  /* If we wanted to, we could actually do a real increase by redeleting and
  /* If we wanted to, we could actually do a real increase by redeleting and
     inserting. However, this would require O (log n) time. So just bail out
     inserting. However, this would require O (log n) time. So just bail out
     for now.  */
     for now.  */
  if (fibheap_comp_data (heap, key, data, node) > 0)
  if (fibheap_comp_data (heap, key, data, node) > 0)
    return NULL;
    return NULL;
 
 
  odata = node->data;
  odata = node->data;
  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)
  if (okey == key)
    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.  */
  if (y != NULL && fibheap_compare (heap, node, y) <= 0)
  if (y != NULL && fibheap_compare (heap, node, y) <= 0)
    {
    {
      fibheap_cut (heap, node, y);
      fibheap_cut (heap, node, y);
      fibheap_cascading_cut (heap, y);
      fibheap_cascading_cut (heap, y);
    }
    }
 
 
  if (fibheap_compare (heap, node, heap->min) <= 0)
  if (fibheap_compare (heap, node, heap->min) <= 0)
    heap->min = node;
    heap->min = node;
 
 
  return odata;
  return odata;
}
}
 
 
/* Replace the DATA associated with NODE.  */
/* Replace the DATA associated with NODE.  */
void *
void *
fibheap_replace_data (fibheap_t heap, fibnode_t node, void *data)
fibheap_replace_data (fibheap_t heap, fibnode_t node, void *data)
{
{
  return fibheap_replace_key_data (heap, node, node->key, data);
  return fibheap_replace_key_data (heap, node, node->key, data);
}
}
 
 
/* Replace the KEY associated with NODE.  */
/* Replace the KEY associated with NODE.  */
fibheapkey_t
fibheapkey_t
fibheap_replace_key (fibheap_t heap, fibnode_t node, fibheapkey_t key)
fibheap_replace_key (fibheap_t heap, fibnode_t node, fibheapkey_t key)
{
{
  int okey = node->key;
  int okey = node->key;
  fibheap_replace_key_data (heap, node, key, node->data);
  fibheap_replace_key_data (heap, node, key, node->data);
  return okey;
  return okey;
}
}
 
 
/* Delete NODE from HEAP.  */
/* Delete NODE from HEAP.  */
void *
void *
fibheap_delete_node (fibheap_t heap, fibnode_t node)
fibheap_delete_node (fibheap_t heap, fibnode_t node)
{
{
  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);
  fibheap_extract_min (heap);
  fibheap_extract_min (heap);
 
 
  return ret;
  return ret;
}
}
 
 
/* Delete HEAP.  */
/* Delete HEAP.  */
void
void
fibheap_delete (fibheap_t heap)
fibheap_delete (fibheap_t heap)
{
{
  while (heap->min != NULL)
  while (heap->min != NULL)
    free (fibheap_extr_min_node (heap));
    free (fibheap_extr_min_node (heap));
 
 
  free (heap);
  free (heap);
}
}
 
 
/* Determine if HEAP is empty.  */
/* Determine if HEAP is empty.  */
int
int
fibheap_empty (fibheap_t heap)
fibheap_empty (fibheap_t heap)
{
{
  return heap->nodes == 0;
  return heap->nodes == 0;
}
}
 
 
/* Extract the minimum node of the heap.  */
/* Extract the minimum node of the heap.  */
static fibnode_t
static fibnode_t
fibheap_extr_min_node (fibheap_t heap)
fibheap_extr_min_node (fibheap_t heap)
{
{
  fibnode_t ret = heap->min;
  fibnode_t ret = heap->min;
  fibnode_t x, y, orig;
  fibnode_t x, y, orig;
 
 
  /* Attach the child list of the minimum node to the root list of the heap.
  /* Attach the child list of the minimum node to the root list of the heap.
     If there is no child list, we don't do squat.  */
     If there is no child list, we don't do squat.  */
  for (x = ret->child, orig = NULL; x != orig && x != NULL; x = y)
  for (x = ret->child, orig = NULL; x != orig && x != NULL; x = y)
    {
    {
      if (orig == NULL)
      if (orig == NULL)
        orig = x;
        orig = x;
      y = x->right;
      y = x->right;
      x->parent = NULL;
      x->parent = NULL;
      fibheap_ins_root (heap, x);
      fibheap_ins_root (heap, x);
    }
    }
 
 
  /* Remove the old root.  */
  /* Remove the old root.  */
  fibheap_rem_root (heap, ret);
  fibheap_rem_root (heap, ret);
  heap->nodes--;
  heap->nodes--;
 
 
  /* If we are left with no nodes, then the min is NULL.  */
  /* If we are left with no nodes, then the min is NULL.  */
  if (heap->nodes == 0)
  if (heap->nodes == 0)
    heap->min = NULL;
    heap->min = NULL;
  else
  else
    {
    {
      /* Otherwise, consolidate to find new minimum, as well as do the reorg
      /* Otherwise, consolidate to find new minimum, as well as do the reorg
         work that needs to be done.  */
         work that needs to be done.  */
      heap->min = ret->right;
      heap->min = ret->right;
      fibheap_consolidate (heap);
      fibheap_consolidate (heap);
    }
    }
 
 
  return ret;
  return ret;
}
}
 
 
/* Insert NODE into the root list of HEAP.  */
/* Insert NODE into the root list of HEAP.  */
static void
static void
fibheap_ins_root (fibheap_t heap, fibnode_t node)
fibheap_ins_root (fibheap_t heap, fibnode_t node)
{
{
  /* If the heap is currently empty, the new node becomes the singleton
  /* If the heap is currently empty, the new node becomes the singleton
     circular root list.  */
     circular root list.  */
  if (heap->root == NULL)
  if (heap->root == NULL)
    {
    {
      heap->root = node;
      heap->root = node;
      node->left = node;
      node->left = node;
      node->right = node;
      node->right = node;
      return;
      return;
    }
    }
 
 
  /* Otherwise, insert it in the circular root list between the root
  /* Otherwise, insert it in the circular root list between the root
     and it's right node.  */
     and it's right node.  */
  fibnode_insert_after (heap->root, node);
  fibnode_insert_after (heap->root, node);
}
}
 
 
/* Remove NODE from the rootlist of HEAP.  */
/* Remove NODE from the rootlist of HEAP.  */
static void
static void
fibheap_rem_root (fibheap_t heap, fibnode_t node)
fibheap_rem_root (fibheap_t heap, fibnode_t node)
{
{
  if (node->left == node)
  if (node->left == node)
    heap->root = NULL;
    heap->root = NULL;
  else
  else
    heap->root = fibnode_remove (node);
    heap->root = fibnode_remove (node);
}
}
 
 
/* Consolidate the heap.  */
/* Consolidate the heap.  */
static void
static void
fibheap_consolidate (fibheap_t heap)
fibheap_consolidate (fibheap_t heap)
{
{
  fibnode_t a[1 + 8 * sizeof (long)];
  fibnode_t a[1 + 8 * sizeof (long)];
  fibnode_t w;
  fibnode_t w;
  fibnode_t y;
  fibnode_t y;
  fibnode_t x;
  fibnode_t x;
  int i;
  int i;
  int d;
  int d;
  int D;
  int D;
 
 
  D = 1 + 8 * sizeof (long);
  D = 1 + 8 * sizeof (long);
 
 
  memset (a, 0, sizeof (fibnode_t) * D);
  memset (a, 0, sizeof (fibnode_t) * D);
 
 
  while ((w = heap->root) != NULL)
  while ((w = heap->root) != NULL)
    {
    {
      x = w;
      x = w;
      fibheap_rem_root (heap, w);
      fibheap_rem_root (heap, w);
      d = x->degree;
      d = x->degree;
      while (a[d] != NULL)
      while (a[d] != NULL)
        {
        {
          y = a[d];
          y = a[d];
          if (fibheap_compare (heap, x, y) > 0)
          if (fibheap_compare (heap, x, y) > 0)
            {
            {
              fibnode_t temp;
              fibnode_t temp;
              temp = x;
              temp = x;
              x = y;
              x = y;
              y = temp;
              y = temp;
            }
            }
          fibheap_link (heap, y, x);
          fibheap_link (heap, y, x);
          a[d] = NULL;
          a[d] = NULL;
          d++;
          d++;
        }
        }
      a[d] = x;
      a[d] = x;
    }
    }
  heap->min = NULL;
  heap->min = NULL;
  for (i = 0; i < D; i++)
  for (i = 0; i < D; i++)
    if (a[i] != NULL)
    if (a[i] != NULL)
      {
      {
        fibheap_ins_root (heap, a[i]);
        fibheap_ins_root (heap, a[i]);
        if (heap->min == NULL || fibheap_compare (heap, a[i], heap->min) < 0)
        if (heap->min == NULL || fibheap_compare (heap, a[i], heap->min) < 0)
          heap->min = a[i];
          heap->min = a[i];
      }
      }
}
}
 
 
/* Make NODE a child of PARENT.  */
/* Make NODE a child of PARENT.  */
static void
static void
fibheap_link (fibheap_t heap ATTRIBUTE_UNUSED,
fibheap_link (fibheap_t heap ATTRIBUTE_UNUSED,
              fibnode_t node, fibnode_t parent)
              fibnode_t node, fibnode_t parent)
{
{
  if (parent->child == NULL)
  if (parent->child == NULL)
    parent->child = node;
    parent->child = node;
  else
  else
    fibnode_insert_before (parent->child, node);
    fibnode_insert_before (parent->child, node);
  node->parent = parent;
  node->parent = parent;
  parent->degree++;
  parent->degree++;
  node->mark = 0;
  node->mark = 0;
}
}
 
 
/* Remove NODE from PARENT's child list.  */
/* Remove NODE from PARENT's child list.  */
static void
static void
fibheap_cut (fibheap_t heap, fibnode_t node, fibnode_t parent)
fibheap_cut (fibheap_t heap, fibnode_t node, fibnode_t parent)
{
{
  fibnode_remove (node);
  fibnode_remove (node);
  parent->degree--;
  parent->degree--;
  fibheap_ins_root (heap, node);
  fibheap_ins_root (heap, node);
  node->parent = NULL;
  node->parent = NULL;
  node->mark = 0;
  node->mark = 0;
}
}
 
 
static void
static void
fibheap_cascading_cut (fibheap_t heap, fibnode_t y)
fibheap_cascading_cut (fibheap_t heap, fibnode_t y)
{
{
  fibnode_t z;
  fibnode_t z;
 
 
  while ((z = y->parent) != NULL)
  while ((z = y->parent) != NULL)
    {
    {
      if (y->mark == 0)
      if (y->mark == 0)
        {
        {
          y->mark = 1;
          y->mark = 1;
          return;
          return;
        }
        }
      else
      else
        {
        {
          fibheap_cut (heap, y, z);
          fibheap_cut (heap, y, z);
          y = z;
          y = z;
        }
        }
    }
    }
}
}
 
 
static void
static void
fibnode_insert_after (fibnode_t a, fibnode_t b)
fibnode_insert_after (fibnode_t a, fibnode_t b)
{
{
  if (a == a->right)
  if (a == a->right)
    {
    {
      a->right = b;
      a->right = b;
      a->left = b;
      a->left = b;
      b->right = a;
      b->right = a;
      b->left = a;
      b->left = a;
    }
    }
  else
  else
    {
    {
      b->right = a->right;
      b->right = a->right;
      a->right->left = b;
      a->right->left = b;
      a->right = b;
      a->right = b;
      b->left = a;
      b->left = a;
    }
    }
}
}
 
 
static fibnode_t
static fibnode_t
fibnode_remove (fibnode_t node)
fibnode_remove (fibnode_t node)
{
{
  fibnode_t ret;
  fibnode_t ret;
 
 
  if (node == node->left)
  if (node == node->left)
    ret = NULL;
    ret = NULL;
  else
  else
    ret = node->left;
    ret = node->left;
 
 
  if (node->parent != NULL && node->parent->child == node)
  if (node->parent != NULL && node->parent->child == node)
    node->parent->child = ret;
    node->parent->child = ret;
 
 
  node->right->left = node->left;
  node->right->left = node->left;
  node->left->right = node->right;
  node->left->right = node->right;
 
 
  node->parent = NULL;
  node->parent = NULL;
  node->left = node;
  node->left = node;
  node->right = node;
  node->right = node;
 
 
  return ret;
  return ret;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.