diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-03-05 15:44:11 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-03-05 15:44:11 -0800 |
commit | ddc522a0c03ead1f84e45e515105a750f84ff265 (patch) | |
tree | 794854b15644dae8c4c9c3e28e197636c2f1b9c2 | |
parent | 6c93249373bb71f7f12cf99286bae0d31d884217 (diff) | |
download | abc-ddc522a0c03ead1f84e45e515105a750f84ff265.tar.gz abc-ddc522a0c03ead1f84e45e515105a750f84ff265.tar.bz2 abc-ddc522a0c03ead1f84e45e515105a750f84ff265.zip |
Bug fix in reader/writer of 'r' section.
-rw-r--r-- | src/aig/gia/giaAiger.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c index 3bbecc7e..2c76b7dc 100644 --- a/src/aig/gia/giaAiger.c +++ b/src/aig/gia/giaAiger.c @@ -662,10 +662,12 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS { int i, nRegs; pCur++; - nRegs = Gia_AigerReadInt(pCur)/4; pCur += 4; + pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4; + nRegs = Gia_AigerReadInt(pCur); pCur += 4; pNew->vRegClasses = Vec_IntAlloc( nRegs ); for ( i = 0; i < nRegs; i++ ) Vec_IntPush( pNew->vRegClasses, Gia_AigerReadInt(pCur) ), pCur += 4; + assert( pCur == pCurTemp ); if ( fVerbose ) printf( "Finished reading extension \"r\".\n" ); } // read choices @@ -1260,7 +1262,8 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int { int i; fprintf( pFile, "r" ); - Gia_FileWriteBufferSize( pFile, 4*Vec_IntSize(p->vRegClasses) ); + Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(p->vRegClasses)+1) ); + Gia_FileWriteBufferSize( pFile, Vec_IntSize(p->vRegClasses) ); for ( i = 0; i < Vec_IntSize(p->vRegClasses); i++ ) Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vRegClasses, i) ); } |