summaryrefslogtreecommitdiffstats
path: root/src/misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/util/abc_global.h6
-rw-r--r--src/misc/vec/vecWrd.h7
2 files changed, 6 insertions, 7 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h
index efd790f6..950a8889 100644
--- a/src/misc/util/abc_global.h
+++ b/src/misc/util/abc_global.h
@@ -246,9 +246,9 @@ static inline double Abc_MinDouble( double a, double b ) { return a < b ?
static inline int Abc_Float2Int( float Val ) { union { int x; float y; } v; v.y = Val; return v.x; }
static inline float Abc_Int2Float( int Num ) { union { int x; float y; } v; v.x = Num; return v.y; }
-static inline int Abc_Base2Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n >>= 1, r++ ); return r; }
-static inline int Abc_Base10Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 10, r++ ); return r; }
-static inline int Abc_Base16Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 16, r++ ); return r; }
+static inline int Abc_Base2Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n >>= 1, r++ ) {}; return r; }
+static inline int Abc_Base10Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 10, r++ ) {}; return r; }
+static inline int Abc_Base16Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 16, r++ ) {}; return r; }
static inline char * Abc_UtilStrsav( char * s ) { return s ? strcpy(ABC_ALLOC(char, strlen(s)+1), s) : NULL; }
static inline int Abc_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
static inline int Abc_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h
index a5beeb37..9c33a5ba 100644
--- a/src/misc/vec/vecWrd.h
+++ b/src/misc/vec/vecWrd.h
@@ -971,8 +971,7 @@ static inline int Vec_WrdEqual( Vec_Wrd_t * p1, Vec_Wrd_t * p2 )
Synopsis [Counts the number of common entries.]
- Description [Assumes that the entries are non-negative integers that
- are not very large, so inversion of the array can be performed.]
+ Description []
SideEffects []
@@ -988,9 +987,9 @@ static inline int Vec_WrdCountCommon( Vec_Wrd_t * p1, Vec_Wrd_t * p2 )
vTemp = p1, p1 = p2, p2 = vTemp;
assert( Vec_WrdSize(p1) >= Vec_WrdSize(p2) );
vTemp = Vec_WrdInvert( p2, -1 );
- Vec_WrdFillExtra( vTemp, Vec_WrdFindMax(p1) + 1, -1 );
+ Vec_WrdFillExtra( vTemp, Vec_WrdFindMax(p1) + 1, ~((word)0) );
Vec_WrdForEachEntry( p1, Entry, i )
- if ( Vec_WrdEntry(vTemp, Entry) >= 0 )
+ if ( Vec_WrdEntry(vTemp, Entry) != ~((word)0) )
Counter++;
Vec_WrdFree( vTemp );
return Counter;