abc/src/base/abci/abcRpo.c
// read one truth table in hexadecimal
read one truth table in hexadecimal
read one truth table in hexadecimal
static void Abc_TruthReadHex(word * pTruth, char * pString, int nVars) {
    int nWords = (nVars < 7) ? 1 : (1 << (nVars - 6));
    int k, Digit, nDigits = (nVars < 7) ? (1 << (nVars-2)) : (nWords << 4);
    char EndSymbol;
    if (pString[0] == '0' && pString[1] == 'x')
        pString += 2;
    EndSymbol = pString[nDigits];
    assert(EndSymbol == ' ' || EndSymbol == '\n' || EndSymbol == '\r' || EndSymbol == '\0');
    for (k = 0; k < nDigits; k++) {
        Digit = Abc_TruthReadHexDigit(pString[nDigits - 1 - k]);
        assert(Digit >= 0 && Digit < 16);
        Abc_TruthSetHex(pTruth, k, Digit);
    }
}
static void Abc_TruthReadHex ( word * pTruth , char * pString , int nVars ) { int nWords = ( nVars < 7 ) ? 1 : ( 1 << ( nVars - 6 ) ) ; int k , Digit , nDigits = ( nVars < 7 ) ? ( 1 << ( nVars - 2 ) ) : ( nWords << 4 ) ; char EndSymbol ; if ( pString [ 0 ] == ' ' && pString [ 1 ] == ' ' ) pString += 2 ; EndSymbol = pString [ nDigits ] ; assert ( EndSymbol == ' ' || EndSymbol == ' \n ' || EndSymbol == ' \r ' || EndSymbol == ' \0 ' ) ; for ( k = 0 ; k < nDigits ; k ++ ) { Digit = Abc_TruthReadHexDigit ( pString [ nDigits - 1 - k ] ) ; assert ( Digit >= 0 && Digit < 16 ) ; Abc_TruthSetHex ( pTruth , k , Digit ) ; } }
read one truth table in hexadecimal
read one truth table in hexadecimal
// skip the first 2 symbols if they are "0x" // get the last symbol // the end symbol of the TT (the one immediately following hex digits) // should be one of the following: space, a new-line, or a zero-terminator // (note that on Windows symbols '\r' can be inserted before each '\n') // read hexadecimal digits in the reverse order // (the last symbol in the string is the least significant digit)