From b74b7dfc2d2065eebc800c9165a3e15caeb4453d Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 12 Aug 2020 15:33:09 -0700 Subject: Extending &sim_read to use non-64-divisible pattern counts. --- src/misc/vec/vecWrd.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/misc/vec') diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h index 3e25c066..663b7a88 100644 --- a/src/misc/vec/vecWrd.h +++ b/src/misc/vec/vecWrd.h @@ -1300,10 +1300,20 @@ static inline Vec_Wrd_t * Vec_WrdReadHex( char * pFileName, int * pnWords, int f p = Vec_WrdAlloc( 1000 ); while ( (c = fgetc(pFile)) != EOF ) { - if ( c == '\n' && nWords == -1 ) - nWords = Vec_WrdSize(p); - if ( c == '\n' || c == '\r' || c == '\t' || c == ' ' ) + if ( c == '\r' || c == '\t' || c == ' ' ) continue; + if ( c == '\n' ) + { + if ( nChars > 0 ) + { + Vec_WrdPush( p, Num ); + nChars = 0; + Num = 0; + } + if ( nWords == -1 && Vec_WrdSize(p) > 0 ) + nWords = Vec_WrdSize(p); + continue; + } Num |= (word)Vec_WrdReadHexOne((char)c) << (nChars * 4); if ( ++nChars < 16 ) continue; -- cgit v1.2.3