Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C++ compilation on newer compilers #342

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/aig/aig/aig.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,29 @@ static inline int Aig_WordFindFirstBit( unsigned uWord )
return -1;
}

ifdef __cplusplus
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You dropped this: #

static inline Aig_Obj_t* Aig_Regular(Aig_Obj_t* p)
{
return reinterpret_cast<Aig_Obj_t*>(reinterpret_cast<intptr_t>(p) & ~01);
}
static inline Aig_Obj_t* Aig_Not(Aig_Obj_t* p)
{
return reinterpret_cast<Aig_Obj_t*>(reinterpret_cast<ABC_PTRUINT_T>(p) ^ 01);
}
static inline Aig_Obj_t* Aig_NotCond(Aig_Obj_t* p, int c)
{
return reinterpret_cast<Aig_Obj_t*>(reinterpret_cast<ABC_PTRUINT_T>(p) ^ (c));
}
static inline int Aig_IsComplement(Aig_Obj_t* p)
{
return static_cast<int>(reinterpret_cast<ABC_PTRUINT_T>(p) & 01);
}
#else
static inline Aig_Obj_t * Aig_Regular( Aig_Obj_t * p ) { return (Aig_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
static inline Aig_Obj_t * Aig_Not( Aig_Obj_t * p ) { return (Aig_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
static inline Aig_Obj_t * Aig_NotCond( Aig_Obj_t * p, int c ) { return (Aig_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
static inline int Aig_IsComplement( Aig_Obj_t * p ) { return (int)((ABC_PTRUINT_T)(p) & 01); }
#endif

static inline int Aig_ManCiNum( Aig_Man_t * p ) { return p->nObjs[AIG_OBJ_CI]; }
static inline int Aig_ManCoNum( Aig_Man_t * p ) { return p->nObjs[AIG_OBJ_CO]; }
Expand Down
19 changes: 19 additions & 0 deletions src/misc/util/abc_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,29 @@ static inline int Abc_LitRegular( int Lit ) { assert(Lit >= 0)
static inline int Abc_Lit2LitV( int * pMap, int Lit ) { assert(Lit >= 0); return Abc_Var2Lit( pMap[Abc_Lit2Var(Lit)], Abc_LitIsCompl(Lit) ); }
static inline int Abc_Lit2LitL( int * pMap, int Lit ) { assert(Lit >= 0); return Abc_LitNotCond( pMap[Abc_Lit2Var(Lit)], Abc_LitIsCompl(Lit) ); }

#ifdef __cplusplus
static inline int Abc_Ptr2Int(void* p)
{
return static_cast<int>(reinterpret_cast<ABC_PTRINT_T>(p));
}
static inline void* Abc_Int2Ptr(int i)
{
return reinterpret_cast<void*>(static_cast<ABC_PTRINT_T>(i));
}
static inline word Abc_Ptr2Wrd(void* p)
{
return static_cast<word>(reinterpret_cast<ABC_PTRUINT_T>(p));
}
static inline void* Abc_Wrd2Ptr(word i)
{
return reinterpret_cast<void*>(static_cast<ABC_PTRUINT_T>(i));
}
#else
static inline int Abc_Ptr2Int( void * p ) { return (int)(ABC_PTRINT_T)p; }
static inline void * Abc_Int2Ptr( int i ) { return (void *)(ABC_PTRINT_T)i; }
static inline word Abc_Ptr2Wrd( void * p ) { return (word)(ABC_PTRUINT_T)p; }
static inline void * Abc_Wrd2Ptr( word i ) { return (void *)(ABC_PTRUINT_T)i; }
#endif

static inline int Abc_Var2Lit2( int Var, int Att ) { assert(!(Att >> 2)); return (Var << 2) + Att; }
static inline int Abc_Lit2Var2( int Lit ) { assert(Lit >= 0); return Lit >> 2; }
Expand Down