Esempio n. 1
0
/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_ListDeleteCube_( Mvc_List_t * pList, Mvc_Cube_t * pPrev, Mvc_Cube_t * pCube )
{
    if ( pPrev == NULL ) // deleting the head cube
        pList->pHead = Mvc_CubeReadNext(pCube);
    else
        pPrev->pNext = pCube->pNext;
    if ( pList->pTail == pCube ) // deleting the tail cube
    {
        assert( Mvc_CubeReadNext(pCube) == NULL );
        pList->pTail = pPrev;
    }
    pList->nItems--;
}
Esempio n. 2
0
/**Function*************************************************************

  Synopsis    [Returns the tail of the linked list given by the head.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Mvc_Cube_t * Mvc_ListGetTailFromHead( Mvc_Cube_t * pHead )
{
    Mvc_Cube_t * pCube, * pTail;
    for ( pTail = pCube = pHead; 
          pCube; 
          pTail = pCube, pCube = Mvc_CubeReadNext(pCube) );
    return pTail;
}
Esempio n. 3
0
/**Function*************************************************************

  Synopsis    [Removes adjacent duplicated cubes from the cube list.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverRemoveDuplicates( Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pPrev, * pCube, * pCube2;
    int  fEqual;

    // set the first cube of the cover
    pPrev = Mvc_CoverReadCubeHead(pCover);
    // go through all the cubes after this one
    Mvc_CoverForEachCubeStartSafe( Mvc_CubeReadNext(pPrev), pCube, pCube2 )
    {
        // compare the current cube with the prev cube
        Mvc_CubeBitEqual( fEqual, pPrev, pCube );
        if ( fEqual )
        { // they are equal - remove the current cube
            Mvc_CoverDeleteCube( pCover, pPrev, pCube );
            Mvc_CubeFree( pCover, pCube );
            // don't change the previous cube cube
        }
        else
        { // they are not equal - update the previous cube
            pPrev = pCube;
        }
    }