abc/src/bdd/cudd/cuddZddGroup.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.  The high and low fields of treenode are indices.  From
  those 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.  The high and low fields of treenode are indices.  From
those 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 . The high and low fields of treenode are indices . From those we need to derive the current positions and find maximum and minimum . ] SideEffects [ The bounds are returned as side effects . ]
static void
zddFindNodeHiLo(
  DdManager * table,
  MtrNode * treenode,
  int * lower,
  int * upper)
{
    int low;
    int high;
    if ((int) treenode->low >= table->sizeZ) {
        *lower = table->sizeZ;
        *upper = -1;
        return;
    }
    *lower = low = (unsigned int) table->permZ[treenode->index];
    high = (int) (low + treenode->size - 1);
    if (high >= table->sizeZ) {
        MtrNode *auxnode = treenode->child;
        if (auxnode == NULL) {
            *upper = (unsigned int) table->sizeZ - 1;
        } else {
            while (auxnode != NULL) {
                int thisLower = table->permZ[auxnode->low];
                int thisUpper = thisLower + auxnode->size - 1;
                if (thisUpper >= table->sizeZ && thisLower < table->sizeZ)
                    *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 zddFindNodeHiLo ( DdManager * table , MtrNode * treenode , int * lower , int * upper ) { int low ; int high ; if ( ( int ) treenode -> low >= table -> sizeZ ) { * lower = table -> sizeZ ; * upper = -1 ; return ; } * lower = low = ( unsigned int ) table -> permZ [ treenode -> index ] ; high = ( int ) ( low + treenode -> size - 1 ) ; if ( high >= table -> sizeZ ) { MtrNode * auxnode = treenode -> child ; if ( auxnode == NULL ) { * upper = ( unsigned int ) table -> sizeZ - 1 ; } else { while ( auxnode != NULL ) { int thisLower = table -> permZ [ auxnode -> low ] ; int thisUpper = thisLower + auxnode -> size - 1 ; if ( thisUpper >= table -> sizeZ && thisLower < table -> sizeZ ) * 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->sizeZ line.
            ** If the first group starts at 0 and goes past table->sizeZ
            ** 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. */