From ddc522a0c03ead1f84e45e515105a750f84ff265 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Thu, 5 Mar 2015 15:44:11 -0800 Subject: Bug fix in reader/writer of 'r' section. --- src/aig/gia/giaAiger.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/aig') 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) ); } -- cgit v1.2.3