diff options
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/extra/extra.h | 6 | ||||
-rw-r--r-- | src/misc/util/abc_global.h | 16 | ||||
-rw-r--r-- | src/misc/util/utilTruth.h | 24 | ||||
-rw-r--r-- | src/misc/vec/vecAtt.h | 6 | ||||
-rw-r--r-- | src/misc/vec/vecBit.h | 6 | ||||
-rw-r--r-- | src/misc/vec/vecFlt.h | 10 | ||||
-rw-r--r-- | src/misc/vec/vecHsh.h | 6 | ||||
-rw-r--r-- | src/misc/vec/vecInt.h | 16 | ||||
-rw-r--r-- | src/misc/vec/vecMem.h | 4 | ||||
-rw-r--r-- | src/misc/vec/vecPtr.h | 20 | ||||
-rw-r--r-- | src/misc/vec/vecQue.h | 4 | ||||
-rw-r--r-- | src/misc/vec/vecSet.h | 6 | ||||
-rw-r--r-- | src/misc/vec/vecStr.h | 8 | ||||
-rw-r--r-- | src/misc/vec/vecWec.h | 4 | ||||
-rw-r--r-- | src/misc/vec/vecWrd.h | 10 |
15 files changed, 73 insertions, 73 deletions
diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index 6c0fd74a..e8afebd8 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -249,9 +249,9 @@ static inline void Extra_ProgressBarUpdate( ProgressBar * p, int nItemsCur, char static inline int Extra_BitWordNum( int nBits ) { return nBits/(8*sizeof(unsigned)) + ((nBits%(8*sizeof(unsigned))) > 0); } static inline int Extra_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); } -static inline void Extra_TruthSetBit( unsigned * p, int Bit ) { p[Bit>>5] |= (1<<(Bit & 31)); } -static inline void Extra_TruthXorBit( unsigned * p, int Bit ) { p[Bit>>5] ^= (1<<(Bit & 31)); } -static inline int Extra_TruthHasBit( unsigned * p, int Bit ) { return (p[Bit>>5] & (1<<(Bit & 31))) > 0; } +static inline void Extra_TruthSetBit( unsigned * p, int Bit ) { p[Bit>>5] |= (unsigned)(1<<(Bit & 31)); } +static inline void Extra_TruthXorBit( unsigned * p, int Bit ) { p[Bit>>5] ^= (unsigned)(1<<(Bit & 31)); } +static inline int Extra_TruthHasBit( unsigned * p, int Bit ) { return (p[Bit>>5] & (unsigned)(1<<(Bit & 31))) > 0; } static inline int Extra_WordCountOnes( unsigned uWord ) { diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index 197b4901..811103f2 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -280,17 +280,17 @@ static inline int Abc_Float2Int( float Val ) { union { int x; f static inline float Abc_Int2Float( int Num ) { union { int x; float y; } v; v.x = Num; return v.y; } static inline word Abc_Dbl2Word( double Dbl ) { union { word x; double y; } v; v.y = Dbl; return v.x; } static inline double Abc_Word2Dbl( word Num ) { union { word x; double 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 (int)n; for ( r = 0, n--; n; n >>= 1, r++ ) {}; return r; } +static inline int Abc_Base10Log( unsigned n ) { int r; if ( n < 2 ) return (int)n; for ( r = 0, n--; n; n /= 10, r++ ) {}; return r; } +static inline int Abc_Base16Log( unsigned n ) { int r; if ( n < 2 ) return (int)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_Bit6WordNum( int nBits ) { return (nBits>>6) + ((nBits&63) > 0); } static inline int Abc_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); } static inline int Abc_Truth6WordNum( int nVars ) { return nVars <= 6 ? 1 : (1 << (nVars - 6)); } -static inline int Abc_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; } -static inline void Abc_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); } -static inline void Abc_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); } +static inline int Abc_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (unsigned)(1<<((i) & 31))) > 0; } +static inline void Abc_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (unsigned)(1<<((i) & 31)); } +static inline void Abc_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (unsigned)(1<<((i) & 31)); } static inline unsigned Abc_InfoMask( int nVar ) { return (~(unsigned)0) >> (32-nVar); } static inline int Abc_Var2Lit( int Var, int c ) { assert(Var >= 0 && !(c >> 1)); return Var + Var + c; } @@ -438,7 +438,7 @@ static inline int Abc_PrimeCudd( unsigned int p ) i = 3; while ((unsigned) (i * i) <= p) { - if (p % i == 0) { + if (p % (unsigned)i == 0) { pn = 0; break; } @@ -448,7 +448,7 @@ static inline int Abc_PrimeCudd( unsigned int p ) else pn = 0; } while (!pn); - return(p); + return (int)(p); } // end of Cudd_Prime diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h index 3d3f80b8..8d28d33e 100644 --- a/src/misc/util/utilTruth.h +++ b/src/misc/util/utilTruth.h @@ -146,24 +146,24 @@ static inline int Abc_TtBitCount16( int i ) { return Abc_TtBitCount8[i & 0xFF] + ***********************************************************************/ // read/write/flip i-th bit of a bit string table: -static inline int Abc_TtGetBit( word * p, int i ) { return (int)(p[i>>6] >> (i & 63)) & 1; } -static inline void Abc_TtSetBit( word * p, int i ) { p[i>>6] |= (((word)1)<<(i & 63)); } -static inline void Abc_TtXorBit( word * p, int i ) { p[i>>6] ^= (((word)1)<<(i & 63)); } +static inline int Abc_TtGetBit( word * p, int i ) { return (int)(p[i>>6] >> (word)(i & 63)) & 1; } +static inline void Abc_TtSetBit( word * p, int i ) { p[i>>6] |= (word)(((word)1)<<(i & 63)); } +static inline void Abc_TtXorBit( word * p, int i ) { p[i>>6] ^= (word)(((word)1)<<(i & 63)); } // read/write k-th digit d of a quaternary number: -static inline int Abc_TtGetQua( word * p, int k ) { return (int)(p[k>>5] >> ((k<<1) & 63)) & 3; } -static inline void Abc_TtSetQua( word * p, int k, int d ) { p[k>>5] |= (((word)d)<<((k<<1) & 63)); } -static inline void Abc_TtXorQua( word * p, int k, int d ) { p[k>>5] ^= (((word)d)<<((k<<1) & 63)); } +static inline int Abc_TtGetQua( word * p, int k ) { return (int)(p[k>>5] >> (word)((k<<1) & 63)) & 3; } +static inline void Abc_TtSetQua( word * p, int k, int d ) { p[k>>5] |= (word)(((word)d)<<((k<<1) & 63)); } +static inline void Abc_TtXorQua( word * p, int k, int d ) { p[k>>5] ^= (word)(((word)d)<<((k<<1) & 63)); } // read/write k-th digit d of a hexadecimal number: -static inline int Abc_TtGetHex( word * p, int k ) { return (int)(p[k>>4] >> ((k<<2) & 63)) & 15; } -static inline void Abc_TtSetHex( word * p, int k, int d ) { p[k>>4] |= (((word)d)<<((k<<2) & 63)); } -static inline void Abc_TtXorHex( word * p, int k, int d ) { p[k>>4] ^= (((word)d)<<((k<<2) & 63)); } +static inline int Abc_TtGetHex( word * p, int k ) { return (int)(p[k>>4] >> (word)((k<<2) & 63)) & 15; } +static inline void Abc_TtSetHex( word * p, int k, int d ) { p[k>>4] |= (word)(((word)d)<<((k<<2) & 63)); } +static inline void Abc_TtXorHex( word * p, int k, int d ) { p[k>>4] ^= (word)(((word)d)<<((k<<2) & 63)); } // read/write k-th digit d of a 256-base number: -static inline int Abc_TtGet256( word * p, int k ) { return (int)(p[k>>3] >> ((k<<3) & 63)) & 255; } -static inline void Abc_TtSet256( word * p, int k, int d ) { p[k>>3] |= (((word)d)<<((k<<3) & 63)); } -static inline void Abc_TtXor256( word * p, int k, int d ) { p[k>>3] ^= (((word)d)<<((k<<3) & 63)); } +static inline int Abc_TtGet256( word * p, int k ) { return (int)(p[k>>3] >> (word)((k<<3) & 63)) & 255; } +static inline void Abc_TtSet256( word * p, int k, int d ) { p[k>>3] |= (word)(((word)d)<<((k<<3) & 63)); } +static inline void Abc_TtXor256( word * p, int k, int d ) { p[k>>3] ^= (word)(((word)d)<<((k<<3) & 63)); } /**Function************************************************************* diff --git a/src/misc/vec/vecAtt.h b/src/misc/vec/vecAtt.h index 63dd4779..dc2a4923 100644 --- a/src/misc/vec/vecAtt.h +++ b/src/misc/vec/vecAtt.h @@ -108,7 +108,7 @@ static inline Vec_Att_t * Vec_AttAlloc( p->pFuncFreeObj = pFuncFreeObj; p->nCap = nSize? nSize : 16; p->pArrayPtr = ABC_ALLOC( void *, p->nCap ); - memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap ); + memset( p->pArrayPtr, 0, sizeof(void *) * (size_t)p->nCap ); return p; } @@ -167,7 +167,7 @@ static inline void Vec_AttClear( Vec_Att_t * p ) if ( p->pArrayPtr[i] ) p->pFuncFreeObj( p->pMan, p->pArrayPtr[i] ); } - memset( p->pArrayPtr, 0, sizeof(void *) * p->nCap ); + memset( p->pArrayPtr, 0, sizeof(void *) * (size_t)p->nCap ); } /**Function************************************************************* @@ -209,7 +209,7 @@ static inline void Vec_AttGrow( Vec_Att_t * p, int nCapMin ) if ( p->nCap >= nCapMin ) return; p->pArrayPtr = ABC_REALLOC( void *, p->pArrayPtr, nCapMin ); - memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (nCapMin - p->nCap) ); + memset( p->pArrayPtr + p->nCap, 0, sizeof(void *) * (size_t)(nCapMin - p->nCap) ); p->nCap = nCapMin; } diff --git a/src/misc/vec/vecBit.h b/src/misc/vec/vecBit.h index 543a1258..e41d95aa 100644 --- a/src/misc/vec/vecBit.h +++ b/src/misc/vec/vecBit.h @@ -105,7 +105,7 @@ static inline Vec_Bit_t * Vec_BitStart( int nSize ) nSize = (nSize >> 5) + ((nSize & 31) > 0); p = Vec_BitAlloc( nSize * 32 ); p->nSize = nSize * 32; - memset( p->pArray, 0, sizeof(int) * nSize ); + memset( p->pArray, 0, sizeof(int) * (size_t)nSize ); return p; } @@ -126,7 +126,7 @@ static inline Vec_Bit_t * Vec_BitStartFull( int nSize ) nSize = (nSize >> 5) + ((nSize & 31) > 0); p = Vec_BitAlloc( nSize * 32 ); p->nSize = nSize * 32; - memset( p->pArray, 0xff, sizeof(int) * nSize ); + memset( p->pArray, 0xff, sizeof(int) * (size_t)nSize ); return p; } @@ -149,7 +149,7 @@ static inline Vec_Bit_t * Vec_BitDup( Vec_Bit_t * pVec ) p->nSize = pVec->nSize; p->nCap = pVec->nSize; p->pArray = p->nCap? ABC_ALLOC( int, p->nCap >> 5 ) : NULL; - memcpy( p->pArray, pVec->pArray, sizeof(int) * (p->nCap >> 5) ); + memcpy( p->pArray, pVec->pArray, sizeof(int) * (size_t)(p->nCap >> 5) ); return p; } diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h index b5c5e498..ea43ae24 100644 --- a/src/misc/vec/vecFlt.h +++ b/src/misc/vec/vecFlt.h @@ -113,7 +113,7 @@ static inline Vec_Flt_t * Vec_FltStart( int nSize ) Vec_Flt_t * p; p = Vec_FltAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0, sizeof(float) * nSize ); + memset( p->pArray, 0, sizeof(float) * (size_t)nSize ); return p; } static inline Vec_Flt_t * Vec_FltStartFull( int nSize ) @@ -121,7 +121,7 @@ static inline Vec_Flt_t * Vec_FltStartFull( int nSize ) Vec_Flt_t * p; p = Vec_FltAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0xFF, sizeof(float) * nSize ); + memset( p->pArray, 0xFF, sizeof(float) * (size_t)nSize ); return p; } @@ -164,7 +164,7 @@ static inline Vec_Flt_t * Vec_FltAllocArrayCopy( float * pArray, int nSize ) p->nSize = nSize; p->nCap = nSize; p->pArray = ABC_ALLOC( float, nSize ); - memcpy( p->pArray, pArray, sizeof(float) * nSize ); + memcpy( p->pArray, pArray, sizeof(float) * (size_t)nSize ); return p; } @@ -186,7 +186,7 @@ static inline Vec_Flt_t * Vec_FltDup( Vec_Flt_t * pVec ) p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = p->nCap? ABC_ALLOC( float, p->nCap ) : NULL; - memcpy( p->pArray, pVec->pArray, sizeof(float) * pVec->nSize ); + memcpy( p->pArray, pVec->pArray, sizeof(float) * (size_t)pVec->nSize ); return p; } @@ -347,7 +347,7 @@ static inline int Vec_FltCap( Vec_Flt_t * p ) ***********************************************************************/ static inline double Vec_FltMemory( Vec_Flt_t * p ) { - return !p ? 0.0 : 1.0 * sizeof(float) * p->nCap + sizeof(Vec_Flt_t); + return !p ? 0.0 : 1.0 * sizeof(float) * (size_t)p->nCap + sizeof(Vec_Flt_t); } /**Function************************************************************* diff --git a/src/misc/vec/vecHsh.h b/src/misc/vec/vecHsh.h index 0305db12..00da8450 100644 --- a/src/misc/vec/vecHsh.h +++ b/src/misc/vec/vecHsh.h @@ -307,7 +307,7 @@ static inline int * Hsh_IntManLookup( Hsh_IntMan_t * p, unsigned * pData ) Hsh_IntObj_t * pObj; int * pPlace = Vec_IntEntryP( p->vTable, Hsh_IntManHash(pData, p->nSize, Vec_IntSize(p->vTable)) ); for ( ; (pObj = Hsh_IntObj(p, *pPlace)); pPlace = &pObj->iNext ) - if ( !memcmp( pData, Hsh_IntData(p, pObj->iData), sizeof(int) * p->nSize ) ) + if ( !memcmp( pData, Hsh_IntData(p, pObj->iData), sizeof(int) * (size_t)p->nSize ) ) return pPlace; assert( *pPlace == -1 ); return pPlace; @@ -377,7 +377,7 @@ static inline Hsh_IntMan_t * Hsh_WrdManHashArrayStart( Vec_Wrd_t * vDataW, int n Hsh_IntMan_t * p; int i, nEntries = Vec_WrdSize(vDataW) / nSize; Vec_Int_t * vData = Vec_IntAlloc( 2*Vec_WrdSize(vDataW) ); - memcpy( Vec_IntArray(vData), Vec_WrdArray(vDataW), sizeof(word)*Vec_WrdSize(vDataW) ); + memcpy( Vec_IntArray(vData), Vec_WrdArray(vDataW), sizeof(word)*(size_t)Vec_WrdSize(vDataW) ); vData->nSize = 2*Vec_WrdSize(vDataW); /* for ( i = 0; i < 30; i++ ) @@ -528,7 +528,7 @@ static inline int Hsh_VecManAdd( Hsh_VecMan_t * p, Vec_Int_t * vVec ) } pPlace = Vec_IntEntryP( p->vTable, Hsh_VecManHash(vVec, Vec_IntSize(p->vTable)) ); for ( ; (pObj = Hsh_VecObj(p, *pPlace)); pPlace = &pObj->iNext ) - if ( pObj->nSize == Vec_IntSize(vVec) && !memcmp( pObj->pArray, Vec_IntArray(vVec), sizeof(int) * pObj->nSize ) ) + if ( pObj->nSize == Vec_IntSize(vVec) && !memcmp( pObj->pArray, Vec_IntArray(vVec), sizeof(int) * (size_t)pObj->nSize ) ) return *pPlace; *pPlace = Vec_IntSize(p->vMap); assert( Vec_IntSize(p->vData) % 2 == 0 ); diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 76c0aca2..514ce455 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -127,7 +127,7 @@ static inline Vec_Int_t * Vec_IntStart( int nSize ) Vec_Int_t * p; p = Vec_IntAlloc( nSize ); p->nSize = nSize; - if ( p->pArray ) memset( p->pArray, 0, sizeof(int) * nSize ); + if ( p->pArray ) memset( p->pArray, 0, sizeof(int) * (size_t)nSize ); return p; } static inline Vec_Int_t * Vec_IntStartFull( int nSize ) @@ -135,7 +135,7 @@ static inline Vec_Int_t * Vec_IntStartFull( int nSize ) Vec_Int_t * p; p = Vec_IntAlloc( nSize ); p->nSize = nSize; - if ( p->pArray ) memset( p->pArray, 0xff, sizeof(int) * nSize ); + if ( p->pArray ) memset( p->pArray, 0xff, sizeof(int) * (size_t)nSize ); return p; } static inline Vec_Int_t * Vec_IntStartRange( int First, int Range ) @@ -210,7 +210,7 @@ static inline Vec_Int_t * Vec_IntAllocArrayCopy( int * pArray, int nSize ) p->nSize = nSize; p->nCap = nSize; p->pArray = ABC_ALLOC( int, nSize ); - memcpy( p->pArray, pArray, sizeof(int) * nSize ); + memcpy( p->pArray, pArray, sizeof(int) * (size_t)nSize ); return p; } @@ -232,7 +232,7 @@ static inline Vec_Int_t * Vec_IntDup( Vec_Int_t * pVec ) p->nSize = pVec->nSize; p->nCap = pVec->nSize; p->pArray = p->nCap? ABC_ALLOC( int, p->nCap ) : NULL; - memcpy( p->pArray, pVec->pArray, sizeof(int) * pVec->nSize ); + memcpy( p->pArray, pVec->pArray, sizeof(int) * (size_t)pVec->nSize ); return p; } @@ -331,7 +331,7 @@ static inline int * Vec_IntReleaseNewArray( Vec_Int_t * p ) { int * pArray = ABC_ALLOC( int, p->nSize+1 ); pArray[0] = p->nSize+1; - memcpy( pArray+1, p->pArray, sizeof(int)*p->nSize ); + memcpy( pArray+1, p->pArray, sizeof(int)*(size_t)p->nSize ); return pArray; } @@ -404,7 +404,7 @@ static inline int Vec_IntCap( Vec_Int_t * p ) ***********************************************************************/ static inline double Vec_IntMemory( Vec_Int_t * p ) { - return !p ? 0.0 : 1.0 * sizeof(int) * p->nCap + sizeof(Vec_Int_t) ; + return !p ? 0.0 : 1.0 * sizeof(int) * (size_t)p->nCap + sizeof(Vec_Int_t) ; } /**Function************************************************************* @@ -1558,7 +1558,7 @@ static inline int * Vec_IntUniqueLookup( Vec_Int_t * vData, int i, int nIntSize, { int * pData = Vec_IntEntryP( vData, i*nIntSize ); for ( ; *pStart != -1; pStart = pNexts + *pStart ) - if ( !memcmp( pData, Vec_IntEntryP(vData, *pStart*nIntSize), sizeof(int) * nIntSize ) ) + if ( !memcmp( pData, Vec_IntEntryP(vData, *pStart*nIntSize), sizeof(int) * (size_t)nIntSize ) ) return pStart; return pStart; } @@ -2018,7 +2018,7 @@ static inline int Vec_IntCompareVec( Vec_Int_t * p1, Vec_Int_t * p2 ) return (p1 != NULL) - (p2 != NULL); if ( Vec_IntSize(p1) != Vec_IntSize(p2) ) return Vec_IntSize(p1) - Vec_IntSize(p2); - return memcmp( Vec_IntArray(p1), Vec_IntArray(p2), sizeof(int)*Vec_IntSize(p1) ); + return memcmp( Vec_IntArray(p1), Vec_IntArray(p2), sizeof(int)*(size_t)Vec_IntSize(p1) ); } /**Function************************************************************* diff --git a/src/misc/vec/vecMem.h b/src/misc/vec/vecMem.h index c2bd06f0..ef2d2af7 100644 --- a/src/misc/vec/vecMem.h +++ b/src/misc/vec/vecMem.h @@ -236,12 +236,12 @@ static inline word * Vec_MemGetEntry( Vec_Mem_t * p, int i ) static inline void Vec_MemSetEntry( Vec_Mem_t * p, int i, word * pEntry ) { word * pPlace = Vec_MemGetEntry( p, i ); - memmove( pPlace, pEntry, sizeof(word) * p->nEntrySize ); + memmove( pPlace, pEntry, sizeof(word) * (size_t)p->nEntrySize ); } static inline void Vec_MemPush( Vec_Mem_t * p, word * pEntry ) { word * pPlace = Vec_MemGetEntry( p, p->nEntries ); - memmove( pPlace, pEntry, sizeof(word) * p->nEntrySize ); + memmove( pPlace, pEntry, sizeof(word) * (size_t)p->nEntrySize ); } /**Function************************************************************* diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index 3cdd25d6..4b76b69f 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -120,7 +120,7 @@ static inline Vec_Ptr_t * Vec_PtrStart( int nSize ) Vec_Ptr_t * p; p = Vec_PtrAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0, sizeof(void *) * nSize ); + memset( p->pArray, 0, sizeof(void *) * (size_t)nSize ); return p; } @@ -163,7 +163,7 @@ static inline Vec_Ptr_t * Vec_PtrAllocArrayCopy( void ** pArray, int nSize ) p->nSize = nSize; p->nCap = nSize; p->pArray = ABC_ALLOC( void *, nSize ); - memcpy( p->pArray, pArray, sizeof(void *) * nSize ); + memcpy( p->pArray, pArray, sizeof(void *) * (size_t)nSize ); return p; } @@ -185,7 +185,7 @@ static inline Vec_Ptr_t * Vec_PtrDup( Vec_Ptr_t * pVec ) p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = p->nCap? ABC_ALLOC( void *, p->nCap ) : NULL; - memcpy( p->pArray, pVec->pArray, sizeof(void *) * pVec->nSize ); + memcpy( p->pArray, pVec->pArray, sizeof(void *) * (size_t)pVec->nSize ); return p; } static inline Vec_Ptr_t * Vec_PtrDupStr( Vec_Ptr_t * pVec ) @@ -350,7 +350,7 @@ static inline int Vec_PtrCap( Vec_Ptr_t * p ) ***********************************************************************/ static inline double Vec_PtrMemory( Vec_Ptr_t * p ) { - return !p ? 0.0 : 1.0 * sizeof(void *) * p->nCap + sizeof(Vec_Ptr_t); + return !p ? 0.0 : 1.0 * sizeof(void *) * (size_t)p->nCap + sizeof(Vec_Ptr_t); } /**Function************************************************************* @@ -620,7 +620,7 @@ static inline void Vec_PtrCopy( Vec_Ptr_t * pDest, Vec_Ptr_t * pSour ) { pDest->nSize = 0; Vec_PtrGrow( pDest, pSour->nSize ); - memcpy( pDest->pArray, pSour->pArray, sizeof(void *) * pSour->nSize ); + memcpy( pDest->pArray, pSour->pArray, sizeof(void *) * (size_t)pSour->nSize ); pDest->nSize = pSour->nSize; } @@ -824,8 +824,8 @@ static inline void Vec_PtrReorder( Vec_Ptr_t * p, int nItems ) { assert( nItems < p->nSize ); Vec_PtrGrow( p, nItems + p->nSize ); - memmove( (char **)p->pArray + p->nSize, p->pArray, nItems * sizeof(void*) ); - memmove( p->pArray, (char **)p->pArray + nItems, p->nSize * sizeof(void*) ); + memmove( (char **)p->pArray + p->nSize, p->pArray, (size_t)nItems * sizeof(void*) ); + memmove( p->pArray, (char **)p->pArray + nItems, (size_t)p->nSize * sizeof(void*) ); } /**Function************************************************************* @@ -988,7 +988,7 @@ static inline Vec_Ptr_t * Vec_PtrAllocSimInfo( int nEntries, int nWords ) void ** pMemory; unsigned * pInfo; int i; - pMemory = (void **)ABC_ALLOC( char, (sizeof(void *) + sizeof(unsigned) * nWords) * nEntries ); + pMemory = (void **)ABC_ALLOC( char, (sizeof(void *) + sizeof(unsigned) * (size_t)nWords) * nEntries ); pInfo = (unsigned *)(pMemory + nEntries); for ( i = 0; i < nEntries; i++ ) pMemory[i] = pInfo + i * nWords; @@ -1026,7 +1026,7 @@ static inline void Vec_PtrCleanSimInfo( Vec_Ptr_t * vInfo, int iWord, int nWords { int i; for ( i = 0; i < vInfo->nSize; i++ ) - memset( (char*)Vec_PtrEntry(vInfo,i) + 4*iWord, 0, 4*(nWords-iWord) ); + memset( (char*)Vec_PtrEntry(vInfo,i) + 4*iWord, 0, (size_t)(4*(nWords-iWord)) ); } /**Function************************************************************* @@ -1044,7 +1044,7 @@ static inline void Vec_PtrFillSimInfo( Vec_Ptr_t * vInfo, int iWord, int nWords { int i; for ( i = 0; i < vInfo->nSize; i++ ) - memset( (char*)Vec_PtrEntry(vInfo,i) + 4*iWord, 0xFF, 4*(nWords-iWord) ); + memset( (char*)Vec_PtrEntry(vInfo,i) + 4*iWord, 0xFF, (size_t)(4*(nWords-iWord)) ); } /**Function************************************************************* diff --git a/src/misc/vec/vecQue.h b/src/misc/vec/vecQue.h index 3028d737..54a10a29 100644 --- a/src/misc/vec/vecQue.h +++ b/src/misc/vec/vecQue.h @@ -103,8 +103,8 @@ static inline void Vec_QueGrow( Vec_Que_t * p, int nCapMin ) return; p->pHeap = ABC_REALLOC( int, p->pHeap, nCapMin ); p->pOrder = ABC_REALLOC( int, p->pOrder, nCapMin ); - memset( p->pHeap + p->nCap, 0xff, (nCapMin - p->nCap) * sizeof(int) ); - memset( p->pOrder + p->nCap, 0xff, (nCapMin - p->nCap) * sizeof(int) ); + memset( p->pHeap + p->nCap, 0xff, (size_t)(nCapMin - p->nCap) * sizeof(int) ); + memset( p->pOrder + p->nCap, 0xff, (size_t)(nCapMin - p->nCap) * sizeof(int) ); p->nCap = nCapMin; } static inline void Vec_QueClear( Vec_Que_t * p ) diff --git a/src/misc/vec/vecSet.h b/src/misc/vec/vecSet.h index e2ae337f..1f62783e 100644 --- a/src/misc/vec/vecSet.h +++ b/src/misc/vec/vecSet.h @@ -195,7 +195,7 @@ static inline double Vec_ReportMemory( Vec_Set_t * p ) { double Mem = sizeof(Vec_Set_t); Mem += p->nPagesAlloc * sizeof(void *); - Mem += sizeof(word) * (int)(((word)1) << p->nPageSize) * (1 + p->iPage); + Mem += sizeof(word) * (size_t)(((word)1) << p->nPageSize) * (size_t)(1 + p->iPage); return Mem; } @@ -220,7 +220,7 @@ static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize ) if ( ++p->iPage == p->nPagesAlloc ) { p->pPages = ABC_REALLOC( word *, p->pPages, p->nPagesAlloc * 2 ); - memset( p->pPages + p->nPagesAlloc, 0, sizeof(word *) * p->nPagesAlloc ); + memset( p->pPages + p->nPagesAlloc, 0, sizeof(word *) * (size_t)p->nPagesAlloc ); p->nPagesAlloc *= 2; } if ( p->pPages[p->iPage] == NULL ) @@ -229,7 +229,7 @@ static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize ) p->pPages[p->iPage][1] = ~0; } if ( pArray ) - memcpy( p->pPages[p->iPage] + Vec_SetLimit(p->pPages[p->iPage]), pArray, sizeof(int) * nSize ); + memcpy( p->pPages[p->iPage] + Vec_SetLimit(p->pPages[p->iPage]), pArray, sizeof(int) * (size_t)nSize ); Vec_SetIncLimit( p->pPages[p->iPage], nWords ); return Vec_SetHandCurrent(p) - nWords; } diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h index 8c8f7e6e..12053d3d 100644 --- a/src/misc/vec/vecStr.h +++ b/src/misc/vec/vecStr.h @@ -107,7 +107,7 @@ static inline Vec_Str_t * Vec_StrStart( int nSize ) Vec_Str_t * p; p = Vec_StrAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0, sizeof(char) * nSize ); + memset( p->pArray, 0, sizeof(char) * (size_t)nSize ); return p; } @@ -150,7 +150,7 @@ static inline Vec_Str_t * Vec_StrAllocArrayCopy( char * pArray, int nSize ) p->nSize = nSize; p->nCap = nSize; p->pArray = ABC_ALLOC( char, nSize ); - memcpy( p->pArray, pArray, sizeof(char) * nSize ); + memcpy( p->pArray, pArray, sizeof(char) * (size_t)nSize ); return p; } @@ -172,7 +172,7 @@ static inline Vec_Str_t * Vec_StrDup( Vec_Str_t * pVec ) p->nSize = pVec->nSize; p->nCap = pVec->nCap; p->pArray = p->nCap? ABC_ALLOC( char, p->nCap ) : NULL; - memcpy( p->pArray, pVec->pArray, sizeof(char) * pVec->nSize ); + memcpy( p->pArray, pVec->pArray, sizeof(char) * (size_t)pVec->nSize ); return p; } @@ -337,7 +337,7 @@ static inline int Vec_StrCap( Vec_Str_t * p ) ***********************************************************************/ static inline double Vec_StrMemory( Vec_Str_t * p ) { - return !p ? 0.0 : 1.0 * sizeof(char) * p->nCap + sizeof(Vec_Str_t); + return !p ? 0.0 : 1.0 * sizeof(char) * (size_t)p->nCap + sizeof(Vec_Str_t); } /**Function************************************************************* diff --git a/src/misc/vec/vecWec.h b/src/misc/vec/vecWec.h index e4c3d292..88ee3dd7 100644 --- a/src/misc/vec/vecWec.h +++ b/src/misc/vec/vecWec.h @@ -129,7 +129,7 @@ static inline void Vec_WecGrow( Vec_Wec_t * p, int nCapMin ) if ( p->nCap >= nCapMin ) return; p->pArray = ABC_REALLOC( Vec_Int_t, p->pArray, nCapMin ); - memset( p->pArray + p->nCap, 0, sizeof(Vec_Int_t) * (nCapMin - p->nCap) ); + memset( p->pArray + p->nCap, 0, sizeof(Vec_Int_t) * (size_t)(nCapMin - p->nCap) ); p->nCap = nCapMin; } static inline void Vec_WecInit( Vec_Wec_t * p, int nSize ) @@ -339,7 +339,7 @@ static inline double Vec_WecMemory( Vec_Wec_t * p ) if ( p == NULL ) return 0.0; Mem = sizeof(Vec_Int_t) * Vec_WecCap(p); for ( i = 0; i < p->nSize; i++ ) - Mem += sizeof(int) * Vec_IntCap( Vec_WecEntry(p, i) ); + Mem += sizeof(int) * (size_t)Vec_IntCap( Vec_WecEntry(p, i) ); return Mem; } diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h index eb0c137c..45df1c97 100644 --- a/src/misc/vec/vecWrd.h +++ b/src/misc/vec/vecWrd.h @@ -115,7 +115,7 @@ static inline Vec_Wrd_t * Vec_WrdStart( int nSize ) Vec_Wrd_t * p; p = Vec_WrdAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0, sizeof(word) * nSize ); + memset( p->pArray, 0, sizeof(word) * (size_t)nSize ); return p; } @@ -135,7 +135,7 @@ static inline Vec_Wrd_t * Vec_WrdStartFull( int nSize ) Vec_Wrd_t * p; p = Vec_WrdAlloc( nSize ); p->nSize = nSize; - memset( p->pArray, 0xff, sizeof(word) * nSize ); + memset( p->pArray, 0xff, sizeof(word) * (size_t)nSize ); return p; } @@ -200,7 +200,7 @@ static inline Vec_Wrd_t * Vec_WrdAllocArrayCopy( word * pArray, int nSize ) p->nSize = nSize; p->nCap = nSize; p->pArray = ABC_ALLOC( word, nSize ); - memcpy( p->pArray, pArray, sizeof(word) * nSize ); + memcpy( p->pArray, pArray, sizeof(word) * (size_t)nSize ); return p; } @@ -222,7 +222,7 @@ static inline Vec_Wrd_t * Vec_WrdDup( Vec_Wrd_t * pVec ) p->nSize = pVec->nSize; p->nCap = pVec->nSize; p->pArray = p->nCap? ABC_ALLOC( word, p->nCap ) : NULL; - memcpy( p->pArray, pVec->pArray, sizeof(word) * pVec->nSize ); + memcpy( p->pArray, pVec->pArray, sizeof(word) * (size_t)pVec->nSize ); return p; } @@ -377,7 +377,7 @@ static inline int Vec_WrdCap( Vec_Wrd_t * p ) ***********************************************************************/ static inline double Vec_WrdMemory( Vec_Wrd_t * p ) { - return !p ? 0.0 : 1.0 * sizeof(word) * p->nCap + sizeof(Vec_Wrd_t); + return !p ? 0.0 : 1.0 * sizeof(word) * (size_t)p->nCap + sizeof(Vec_Wrd_t); } /**Function************************************************************* |