From dffcc93b8e8779f443762c71098796b01ea7d409 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 18 Aug 2005 08:01:00 -0700 Subject: Version abc50818 --- src/misc/extra/extraUtilFile.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/misc/extra/extraUtilFile.c') diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index faf27dc8..03b31fea 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -318,6 +318,35 @@ void Extra_PrintBinary( FILE * pFile, unsigned Sign[], int nBits ) // fprintf( pFile, "\n" ); } +/**Function************************************************************* + + Synopsis [Prints the hex unsigned into a file.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Extra_PrintHex( FILE * pFile, unsigned uTruth, int nVars ) +{ + int nMints, nDigits, Digit, k; + + // write the number into the file + fprintf( pFile, "0x" ); + nMints = (1 << nVars); + nDigits = nMints / 4; + for ( k = nDigits - 1; k >= 0; k-- ) + { + Digit = ((uTruth >> (k * 4)) & 15); + if ( Digit < 10 ) + fprintf( pFile, "%d", Digit ); + else + fprintf( pFile, "%c", 'a' + Digit-10 ); + } +// fprintf( pFile, "\n" ); +} /**Function************************************************************* -- cgit v1.2.3