abc/src/opt/fxch/FxchDiv.c
/**Function*************************************************************

  Synopsis    [ Add a divisor to the divisors hash table. ]

  Description [ This functions will try to add the divisor store in 
                vCubeFree to the divisor hash table. If the divisor
                is already present in the hash table it will just 
                increment its weight, otherwise it will add the divisor
                and asign an initial weight. ]

  SideEffects [ If the fUpdate option is set, the function will also
                update the divisor priority queue. ]

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [ Add a divisor to the divisors hash table.

Description [ This functions will try to add the divisor store in
vCubeFree to the divisor hash table. If the divisor
is already present in the hash table it will just
increment its weight, otherwise it will add the divisor
and asign an initial weight.

SideEffects [ If the fUpdate option is set, the function will also
update the divisor priority queue.


Function Synopsis [ Add a divisor to the divisors hash table . Description [ This functions will try to add the divisor store in vCubeFree to the divisor hash table . If the divisor is already present in the hash table it will just increment its weight otherwise it will add the divisor and asign an initial weight . SideEffects [ If the fUpdate option is set the function will also update the divisor priority queue .
int Fxch_DivAdd( Fxch_Man_t* pFxchMan,
                 int fUpdate,
                 int fSingleCube,
                 int fBase )
{
    int iDiv = Hsh_VecManAdd( pFxchMan->pDivHash, pFxchMan->vCubeFree );
    if ( iDiv == Vec_FltSize( pFxchMan->vDivWeights ) )
    {
        Vec_WecPushLevel( pFxchMan->vDivCubePairs );
        if ( fSingleCube )
        {
            Vec_FltPush( pFxchMan->vDivWeights,
                         -Vec_IntSize( pFxchMan->vCubeFree ) + 0.9
                         -0.001 * Fxch_ManComputeLevelDiv( pFxchMan, pFxchMan->vCubeFree ) );
        }
        else
        {
            Vec_FltPush( pFxchMan->vDivWeights,
                         -Vec_IntSize( pFxchMan->vCubeFree ) + 0.9
                         -0.0009 * Fxch_ManComputeLevelDiv( pFxchMan, pFxchMan->vCubeFree ) );
        }
    }
    if ( fSingleCube )
        Vec_FltAddToEntry( pFxchMan->vDivWeights, iDiv, 1 );
    else
        Vec_FltAddToEntry( pFxchMan->vDivWeights, iDiv, fBase + Vec_IntSize( pFxchMan->vCubeFree ) - 1 );
    assert( iDiv < Vec_FltSize( pFxchMan->vDivWeights ) );
    if ( fUpdate )
        if ( pFxchMan->vDivPrio )
        {
            if ( Vec_QueIsMember( pFxchMan->vDivPrio, iDiv ) )
                Vec_QueUpdate( pFxchMan->vDivPrio, iDiv );
            else
                Vec_QuePush( pFxchMan->vDivPrio, iDiv );
        }
    return iDiv;
}
int Fxch_DivAdd ( Fxch_Man_t * pFxchMan , int fUpdate , int fSingleCube , int fBase ) { int iDiv = Hsh_VecManAdd ( pFxchMan -> pDivHash , pFxchMan -> vCubeFree ) ; if ( iDiv == Vec_FltSize ( pFxchMan -> vDivWeights ) ) { Vec_WecPushLevel ( pFxchMan -> vDivCubePairs ) ; if ( fSingleCube ) { Vec_FltPush ( pFxchMan -> vDivWeights , - Vec_IntSize ( pFxchMan -> vCubeFree ) + 0.9 - 0.001 * Fxch_ManComputeLevelDiv ( pFxchMan , pFxchMan -> vCubeFree ) ) ; } else { Vec_FltPush ( pFxchMan -> vDivWeights , - Vec_IntSize ( pFxchMan -> vCubeFree ) + 0.9 - 0.0009 * Fxch_ManComputeLevelDiv ( pFxchMan , pFxchMan -> vCubeFree ) ) ; } } if ( fSingleCube ) Vec_FltAddToEntry ( pFxchMan -> vDivWeights , iDiv , 1 ) ; else Vec_FltAddToEntry ( pFxchMan -> vDivWeights , iDiv , fBase + Vec_IntSize ( pFxchMan -> vCubeFree ) - 1 ) ; assert ( iDiv < Vec_FltSize ( pFxchMan -> vDivWeights ) ) ; if ( fUpdate ) if ( pFxchMan -> vDivPrio ) { if ( Vec_QueIsMember ( pFxchMan -> vDivPrio , iDiv ) ) Vec_QueUpdate ( pFxchMan -> vDivPrio , iDiv ) ; else Vec_QuePush ( pFxchMan -> vDivPrio , iDiv ) ; } return iDiv ; }
Function
Synopsis    [ Add a divisor to the divisors hash table. ]
Function Synopsis [ Add a divisor to the divisors hash table . ]
/* Verify if the divisor already exist */ /* Assign initial weight */ /* Increment weight */