summaryrefslogtreecommitdiffstats
path: root/src/misc/extra/extraUtilFile.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2005-08-18 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2005-08-18 08:01:00 -0700
commitdffcc93b8e8779f443762c71098796b01ea7d409 (patch)
tree44113f09a94914013816564bdad846b5939c220a /src/misc/extra/extraUtilFile.c
parent6e496de7ff1a1f9b6f0babc8efb0a13379242505 (diff)
downloadabc-dffcc93b8e8779f443762c71098796b01ea7d409.tar.gz
abc-dffcc93b8e8779f443762c71098796b01ea7d409.tar.bz2
abc-dffcc93b8e8779f443762c71098796b01ea7d409.zip
Version abc50818
Diffstat (limited to 'src/misc/extra/extraUtilFile.c')
-rw-r--r--src/misc/extra/extraUtilFile.c29
1 files changed, 29 insertions, 0 deletions
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*************************************************************