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

  Synopsis    [Compares two arbitrary precision integers.]

  Description [Compares two arbitrary precision integers. Returns 1 if
  the first number is larger; 0 if they are equal; -1 if the second
  number is larger.]

  SideEffects [None]

  SeeAlso     []

******************************************************************************/
Function
Synopsis    [Compares two arbitrary precision integers.]

Description [Compares two arbitrary precision integers. Returns 1 if
the first number is larger; 0 if they are equal; -1 if the second
number is larger.]




Function Synopsis [ Compares two arbitrary precision integers . ] Description [ Compares two arbitrary precision integers . Returns 1 if the first number is larger ; 0 if they are equal ; - 1 if the second number is larger . ]
int
Cudd_ApaCompare(
  int digitsFirst,
  DdApaNumber  first,
  int digitsSecond,
  DdApaNumber  second)
{
    int i;
    int firstNZ, secondNZ;
    for (firstNZ = 0; firstNZ < digitsFirst; firstNZ++)
        if (first[firstNZ] != 0) break;
    for (secondNZ = 0; secondNZ < digitsSecond; secondNZ++)
        if (second[secondNZ] != 0) break;
    if (digitsFirst - firstNZ > digitsSecond - secondNZ) return(1);
    else if (digitsFirst - firstNZ < digitsSecond - secondNZ) return(-1);
    for (i = 0; i < digitsFirst - firstNZ; i++) {
        if (first[firstNZ + i] > second[secondNZ + i]) return(1);
        else if (first[firstNZ + i] < second[secondNZ + i]) return(-1);
    }
    return(0);
}
int Cudd_ApaCompare ( int digitsFirst , DdApaNumber first , int digitsSecond , DdApaNumber second ) { int i ; int firstNZ , secondNZ ; for ( firstNZ = 0 ; firstNZ < digitsFirst ; firstNZ ++ ) if ( first [ firstNZ ] != 0 ) break ; for ( secondNZ = 0 ; secondNZ < digitsSecond ; secondNZ ++ ) if ( second [ secondNZ ] != 0 ) break ; if ( digitsFirst - firstNZ > digitsSecond - secondNZ ) return ( 1 ) ; else if ( digitsFirst - firstNZ < digitsSecond - secondNZ ) return ( -1 ) ; for ( i = 0 ; i < digitsFirst - firstNZ ; i ++ ) { if ( first [ firstNZ + i ] > second [ secondNZ + i ] ) return ( 1 ) ; else if ( first [ firstNZ + i ] < second [ secondNZ + i ] ) return ( -1 ) ; } return ( 0 ) ; }
Function
Synopsis    [Compares two arbitrary precision integers.]
Function Synopsis [ Compares two arbitrary precision integers . ]
/* Find first non-zero in both numbers. */