abc/src/bdd/cudd/cuddGroup.c
/**Function********************************************************************

  Synopsis    [Finds the lower and upper bounds of the group represented
  by treenode.]

  Description [Finds the lower and upper bounds of the group
  represented by treenode.  From the index and size fields we need to
  derive the current positions, and find maximum and minimum.]

  SideEffects [The bounds are returned as side effects.]

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [Finds the lower and upper bounds of the group represented
by treenode.]

Description [Finds the lower and upper bounds of the group
represented by treenode.  From the index and size fields we need to
derive the current positions, and find maximum and minimum.]

SideEffects [The bounds are returned as side effects.]


Function Synopsis [ Finds the lower and upper bounds of the group represented by treenode . ] Description [ Finds the lower and upper bounds of the group represented by treenode . From the index and size fields we need to derive the current positions and find maximum and minimum . ] SideEffects [ The bounds are returned as side effects . ]
static void
ddFindNodeHiLo(
  DdManager * table,
  MtrNode * treenode,
  int * lower,
  int * upper)
{
    int low;
    int high;
    if ((int) treenode->low >= table->size) {
        *lower = table->size;
        *upper = -1;
        return;
    }
    *lower = low = (unsigned int) table->perm[treenode->index];
    high = (int) (low + treenode->size - 1);
    if (high >= table->size) {
        MtrNode *auxnode = treenode->child;
        if (auxnode == NULL) {
            *upper = (unsigned int) table->size - 1;
        } else {
            while (auxnode != NULL) {
                int thisLower = table->perm[auxnode->low];
                int thisUpper = thisLower + auxnode->size - 1;
                if (thisUpper >= table->size && thisLower < table->size)
                    *upper = (unsigned int) thisLower - 1;
                auxnode = auxnode->younger;
            }
        }
    } else {
        *upper = (unsigned int) high;
    }
#ifdef DD_DEBUG
    assert(treenode->size >= *upper - *lower + 1);
#endif
    return;
}
static void ddFindNodeHiLo ( DdManager * table , MtrNode * treenode , int * lower , int * upper ) { int low ; int high ; if ( ( int ) treenode -> low >= table -> size ) { * lower = table -> size ; * upper = -1 ; return ; } * lower = low = ( unsigned int ) table -> perm [ treenode -> index ] ; high = ( int ) ( low + treenode -> size - 1 ) ; if ( high >= table -> size ) { MtrNode * auxnode = treenode -> child ; if ( auxnode == NULL ) { * upper = ( unsigned int ) table -> size - 1 ; } else { while ( auxnode != NULL ) { int thisLower = table -> perm [ auxnode -> low ] ; int thisUpper = thisLower + auxnode -> size - 1 ; if ( thisUpper >= table -> size && thisLower < table -> size ) * upper = ( unsigned int ) thisLower - 1 ; auxnode = auxnode -> younger ; } } } else { * upper = ( unsigned int ) high ; } #ifdef DD_DEBUG assert ( treenode -> size >= * upper - * lower + 1 ) ; #endif return ; }
Function
Synopsis    [Finds the lower and upper bounds of the group represented
by treenode.]
Function Synopsis [ Finds the lower and upper bounds of the group represented by treenode . ]
/* Check whether no variables in this group already exist.
    ** If so, return immediately. The calling procedure will know from
    ** the values of upper that no reordering is needed.
    */ /* This is the case of a partially existing group. The aim is to
        ** reorder as many variables as safely possible.  If the tree
        ** node is terminal, we just reorder the subset of the group
        ** that is currently in existence.  If the group has
        ** subgroups, then we only reorder those subgroups that are
        ** fully instantiated.  This way we avoid breaking up a group.
        */ /* Search the subgroup that strands the table->size line.
            ** If the first group starts at 0 and goes past table->size
            ** upper will get -1, thus correctly signaling that no reordering
            ** should take place.
            */ /* Normal case: All the variables of the group exist. */ /* Make sure that all variables in group are contiguous. */