From f16457aaf5d00b5b44ef3aeef8062d1df9b8f1df Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 10 Apr 2012 00:28:36 -0700 Subject: Added/moved several APIs. --- src/misc/extra/extra.h | 1 + src/misc/extra/extraUtilFile.c | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/misc/extra') diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index 0e9caf84..e9daa87e 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -115,6 +115,7 @@ extern char * Extra_TimeStamp(); extern char * Extra_StringAppend( char * pStrGiven, char * pStrAdd ); extern unsigned Extra_ReadBinary( char * Buffer ); extern void Extra_PrintBinary( FILE * pFile, unsigned Sign[], int nBits ); +extern int Extra_ReadHex( unsigned Sign[], char * pString, int nDigits ); extern int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int nVars ); extern void Extra_PrintHexadecimal( FILE * pFile, unsigned Sign[], int nVars ); extern void Extra_PrintHexadecimalString( char * pString, unsigned Sign[], int nVars ); diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index 9f73a5f1..de8a11cb 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -446,16 +446,9 @@ void Extra_PrintBinary( FILE * pFile, unsigned Sign[], int nBits ) SeeAlso [] ***********************************************************************/ -int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int nVars ) +int Extra_ReadHex( unsigned Sign[], char * pString, int nDigits ) { - int nWords, nDigits, Digit, k, c; - nWords = Extra_TruthWordNum( nVars ); - for ( k = 0; k < nWords; k++ ) - Sign[k] = 0; - // read the number from the string - nDigits = (1 << nVars) / 4; - if ( nDigits == 0 ) - nDigits = 1; + int Digit, k, c; for ( k = 0; k < nDigits; k++ ) { c = nDigits-1-k; @@ -470,6 +463,19 @@ int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int nVars ) } return 1; } +int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int nVars ) +{ + int nWords, nDigits, k; + nWords = Extra_TruthWordNum( nVars ); + for ( k = 0; k < nWords; k++ ) + Sign[k] = 0; + // read the number from the string + nDigits = (1 << nVars) / 4; + if ( nDigits == 0 ) + nDigits = 1; + Extra_ReadHex( Sign, pString, nDigits ); + return 1; +} /**Function************************************************************* -- cgit v1.2.3