mirror of https://github.com/YosysHQ/abc.git
Suggested patch for type-punned warnings
This commit is contained in:
parent
ca9eca3b22
commit
ccb5bb34d7
|
|
@ -50,6 +50,13 @@ struct Gia_PtrAre_t_
|
|||
unsigned fMark : 1; // user mark
|
||||
};
|
||||
|
||||
typedef union Gia_PtrAreInt_t_ Gia_PtrAreInt_t;
|
||||
union Gia_PtrAreInt_t_
|
||||
{
|
||||
Gia_PtrAre_t iGia;
|
||||
unsigned iInt;
|
||||
};
|
||||
|
||||
// tree nodes
|
||||
typedef struct Gia_ObjAre_t_ Gia_ObjAre_t;
|
||||
struct Gia_ObjAre_t_
|
||||
|
|
@ -118,8 +125,8 @@ struct Gia_ManAre_t_
|
|||
int timeCube; // cube checking time
|
||||
};
|
||||
|
||||
static inline Gia_PtrAre_t Gia_Int2Ptr( unsigned n ) { return *(Gia_PtrAre_t *)(&n); }
|
||||
static inline unsigned Gia_Ptr2Int( Gia_PtrAre_t n ) { return (*(int *)(&n)) & 0x7fffffff; }
|
||||
static inline Gia_PtrAre_t Gia_Int2Ptr( unsigned n ) { Gia_PtrAreInt_t g; g.iInt = n; return g.iGia; }
|
||||
static inline unsigned Gia_Ptr2Int( Gia_PtrAre_t n ) { Gia_PtrAreInt_t g = { n }; return g.iInt & 0x7fffffff; }
|
||||
|
||||
static inline int Gia_ObjHasBranch0( Gia_ObjAre_t * q ) { return !q->nStas0 && (q->F[0].nPage || q->F[0].nItem); }
|
||||
static inline int Gia_ObjHasBranch1( Gia_ObjAre_t * q ) { return !q->nStas1 && (q->F[1].nPage || q->F[1].nItem); }
|
||||
|
|
|
|||
|
|
@ -170,11 +170,14 @@ Gia_Man_t * Shr_ManFree( Shr_Man_t * p )
|
|||
***********************************************************************/
|
||||
static inline void Shr_ManAddFanout( Shr_Man_t * p, int iFanin, int iFanout )
|
||||
{
|
||||
Shr_Fan_t FanStr;
|
||||
FanStr.iFan = iFanout;
|
||||
FanStr.Next = Vec_IntEntry(p->vObj2Fan, iFanin);
|
||||
union {
|
||||
Shr_Fan_t sFan;
|
||||
word sWord;
|
||||
} FanStr;
|
||||
FanStr.sFan.iFan = iFanout;
|
||||
FanStr.sFan.Next = Vec_IntEntry(p->vObj2Fan, iFanin);
|
||||
Vec_IntWriteEntry( p->vObj2Fan, iFanin, Vec_WrdSize(p->vFanMem) );
|
||||
Vec_WrdPush(p->vFanMem, *((word *)&FanStr) );
|
||||
Vec_WrdPush(p->vFanMem, FanStr.sWord );
|
||||
}
|
||||
static inline int Shr_ManFanIterStart( Shr_Man_t * p, int iNode )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -512,10 +512,13 @@ word Mio_DeriveTruthTable6( Mio_Gate_t * pGate )
|
|||
{ 0xFFFF0000, 0xFFFF0000 },
|
||||
{ 0x00000000, 0xFFFFFFFF }
|
||||
};
|
||||
unsigned uTruthRes[2];
|
||||
union {
|
||||
unsigned u[2];
|
||||
word w;
|
||||
} uTruthRes;
|
||||
assert( pGate->nInputs <= 6 );
|
||||
Mio_DeriveTruthTable( pGate, uTruths6, pGate->nInputs, 6, uTruthRes );
|
||||
return *((word *)uTruthRes);
|
||||
Mio_DeriveTruthTable( pGate, uTruths6, pGate->nInputs, 6, uTruthRes.u );
|
||||
return uTruthRes.w;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ struct Hsh_IntObj_t_
|
|||
int iNext;
|
||||
};
|
||||
|
||||
typedef union Hsh_IntObjWord_t_ Hsh_IntObjWord_t;
|
||||
union Hsh_IntObjWord_t_
|
||||
{
|
||||
Hsh_IntObj_t wObj;
|
||||
word wWord;
|
||||
};
|
||||
|
||||
typedef struct Hsh_IntMan_t_ Hsh_IntMan_t;
|
||||
struct Hsh_IntMan_t_
|
||||
{
|
||||
|
|
@ -80,7 +87,7 @@ struct Hsh_VecMan_t_
|
|||
|
||||
static inline unsigned * Hsh_IntData( Hsh_IntMan_t * p, int iData ) { return (unsigned *)Vec_IntEntryP( p->vData, p->nSize * iData ); }
|
||||
static inline Hsh_IntObj_t * Hsh_IntObj( Hsh_IntMan_t * p, int iObj ) { return iObj == -1 ? NULL : (Hsh_IntObj_t *)Vec_WrdEntryP( p->vObjs, iObj ); }
|
||||
static inline word Hsh_IntWord( int iData, int iNext ) { Hsh_IntObj_t Obj = {iData, iNext}; return *((word *)&Obj); }
|
||||
static inline word Hsh_IntWord( int iData, int iNext ) { Hsh_IntObjWord_t Obj = { {iData, iNext} }; return Obj.wWord; }
|
||||
|
||||
static inline Hsh_VecObj_t * Hsh_VecObj( Hsh_VecMan_t * p, int i ) { return i == -1 ? NULL : (Hsh_VecObj_t *)Vec_IntEntryP(p->vData, Vec_IntEntry(p->vMap, i)); }
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,10 @@ int Msat_ClauseIsLocked( Msat_Solver_t * p, Msat_Clause_t * pC )
|
|||
***********************************************************************/
|
||||
float Msat_ClauseReadActivity( Msat_Clause_t * pC )
|
||||
{
|
||||
return *((float *)(pC->pData + pC->nSize));
|
||||
float f;
|
||||
|
||||
memcpy( &f, pC->pData + pC->nSize, sizeof (f));
|
||||
return f;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -310,7 +313,7 @@ float Msat_ClauseReadActivity( Msat_Clause_t * pC )
|
|||
***********************************************************************/
|
||||
void Msat_ClauseWriteActivity( Msat_Clause_t * pC, float Num )
|
||||
{
|
||||
*((float *)(pC->pData + pC->nSize)) = Num;
|
||||
memcpy( pC->pData + pC->nSize, &Num, sizeof (Num) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
Loading…
Reference in New Issue