29 #ifndef ABC__misc__extra__extra_h
30 #define ABC__misc__extra__extra_h
34 #define inline __inline // compatible with MS VS 6.0
101 extern char *
Extra_FileGetSimilarName(
char * pFileNameWrong,
char * pS1,
char * pS2,
char * pS3,
char * pS4,
char * pS5 );
116 extern int Extra_FileIsType(
char * pFileName,
char * pS1,
char * pS2,
char * pS3 );
122 extern int Extra_ReadHex(
unsigned Sign[],
char * pString,
int nDigits );
126 extern void Extra_PrintHex( FILE * pFile,
unsigned * pTruth,
int nVars );
134 char * pCharsComment,
char * pCharsStop,
char * pCharsClean );
195 extern void Extra_Truth4VarNPN(
unsigned short ** puCanons,
char ** puPhases,
char ** puPerms,
unsigned char ** puMap );
196 extern void Extra_Truth4VarN(
unsigned short ** puCanons,
char *** puPhases,
char ** ppCounters,
int nPhasesMax );
201 extern void Extra_TruthExpand(
int nVars,
int nWords,
unsigned * puTruth,
unsigned uPhase,
unsigned * puTruthR );
208 extern void Extra_BubbleSort(
int Order[],
int Costs[],
int nSize,
int fIncreasing );
218 extern int Extra_TruthCanonFastN(
int nVarsMax,
int nVarsReal,
unsigned * pt,
unsigned ** pptRes,
char ** ppfRes );
248 static inline int Extra_BitWordNum(
int nBits ) {
return nBits/(8*
sizeof(unsigned)) + ((nBits%(8*
sizeof(unsigned))) > 0); }
253 static inline int Extra_TruthHasBit(
unsigned *
p,
int Bit ) {
return (p[Bit>>5] & (1<<(Bit & 31))) > 0; }
257 uWord = (uWord & 0x55555555) + ((uWord>>1) & 0x55555555);
258 uWord = (uWord & 0x33333333) + ((uWord>>2) & 0x33333333);
259 uWord = (uWord & 0x0F0F0F0F) + ((uWord>>4) & 0x0F0F0F0F);
260 uWord = (uWord & 0x00FF00FF) + ((uWord>>8) & 0x00FF00FF);
261 return (uWord & 0x0000FFFF) + (uWord>>16);
274 if ( pIn0[w] != pIn1[w] )
290 if ( pIn[w] != ~(
unsigned)0 )
298 if ( pIn1[w] & ~pIn2[w] )
318 pOut[w] = ~(
unsigned)0;
326 static inline void Extra_TruthAnd(
unsigned * pOut,
unsigned * pIn0,
unsigned * pIn1,
int nVars )
330 pOut[w] = pIn0[w] & pIn1[w];
332 static inline void Extra_TruthOr(
unsigned * pOut,
unsigned * pIn0,
unsigned * pIn1,
int nVars )
336 pOut[w] = pIn0[w] | pIn1[w];
338 static inline void Extra_TruthSharp(
unsigned * pOut,
unsigned * pIn0,
unsigned * pIn1,
int nVars )
342 pOut[w] = pIn0[w] & ~pIn1[w];
344 static inline void Extra_TruthNand(
unsigned * pOut,
unsigned * pIn0,
unsigned * pIn1,
int nVars )
348 pOut[w] = ~(pIn0[w] & pIn1[w]);
350 static inline void Extra_TruthAndPhase(
unsigned * pOut,
unsigned * pIn0,
unsigned * pIn1,
int nVars,
int fCompl0,
int fCompl1 )
353 if ( fCompl0 && fCompl1 )
356 pOut[w] = ~(pIn0[w] | pIn1[w]);
358 else if ( fCompl0 && !fCompl1 )
361 pOut[w] = ~pIn0[w] & pIn1[w];
363 else if ( !fCompl0 && fCompl1 )
366 pOut[w] = pIn0[w] & ~pIn1[w];
371 pOut[w] = pIn0[w] & pIn1[w];
377 extern void Extra_TruthStretch(
unsigned * pOut,
unsigned * pIn,
int nVars,
int nVarsAll,
unsigned Phase );
378 extern void Extra_TruthShrink(
unsigned * pOut,
unsigned * pIn,
int nVars,
int nVarsAll,
unsigned Phase );
386 extern void Extra_TruthMux(
unsigned * pOut,
unsigned * pCof0,
unsigned * pCof1,
int nVars,
int iVar );
391 extern unsigned Extra_TruthSemiCanonicize(
unsigned * pInOut,
unsigned * pAux,
int nVars,
char * pCanonPerm,
short * pStore );
399 extern int Extra_UtilGetopt(
int argc,
char *argv[],
const char *optstring );
unsigned __int64 word
DECLARATIONS ///.
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
#define ABC_NAMESPACE_HEADER_END
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.