summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Een <niklas@een.se>2013-09-27 00:17:59 -0700
committerNiklas Een <niklas@een.se>2013-09-27 00:17:59 -0700
commit4cc320311067a3aa6f3a7391f2fac7a3c09c4362 (patch)
treebd8adf5b1c2b037d5e8977b797f05e76d6dfa4fa
parentf704aa43fbde77c29a28c83eb10a2a2e1a1f5a54 (diff)
downloadabc-4cc320311067a3aa6f3a7391f2fac7a3c09c4362.tar.gz
abc-4cc320311067a3aa6f3a7391f2fac7a3c09c4362.tar.bz2
abc-4cc320311067a3aa6f3a7391f2fac7a3c09c4362.zip
Fixed a bug in Bridge mode
-rw-r--r--src/misc/util/utilBridge.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/misc/util/utilBridge.c b/src/misc/util/utilBridge.c
index 4303e4dd..ebacd97b 100644
--- a/src/misc/util/utilBridge.c
+++ b/src/misc/util/utilBridge.c
@@ -180,6 +180,19 @@ int Gia_ManToBridgeBadAbs( FILE * pFile )
return 1;
}
+
+static int aigerNumSize( unsigned x )
+{
+ int sz = 1;
+ while (x & ~0x7f)
+ {
+ sz++;
+ x >>= 7;
+ }
+ return sz;
+}
+
+
/**Function*************************************************************
Synopsis []
@@ -195,7 +208,7 @@ void Gia_ManFromBridgeHolds( FILE * pFile, int iPoProved )
{
fprintf( pFile, "%.6d", 101 /*message type = Result*/);
fprintf( pFile, " " );
- fprintf( pFile, "%.16d", 4 /*size in bytes*/);
+ fprintf( pFile, "%.16d", 3 + aigerNumSize(iPoProved) /*size in bytes*/);
fprintf( pFile, " " );
fputc( (char)BRIDGE_VALUE_1, pFile ); // true
@@ -208,7 +221,7 @@ void Gia_ManFromBridgeUnknown( FILE * pFile, int iPoUnknown )
{
fprintf( pFile, "%.6d", 101 /*message type = Result*/);
fprintf( pFile, " " );
- fprintf( pFile, "%.16d", 3 /*size in bytes*/);
+ fprintf( pFile, "%.16d", 2 + aigerNumSize(iPoUnknown) /*size in bytes*/);
fprintf( pFile, " " );
fputc( (char)BRIDGE_VALUE_X, pFile ); // undef