mirror of https://github.com/YosysHQ/abc.git
Merge pull request #460 from calewis/fix_ub
Make multiplications use unsigned to avoid UB on overflow
This commit is contained in:
commit
bc0f65cbfc
|
|
@ -90,10 +90,10 @@ struct Abc_Aig_t_
|
||||||
static unsigned Abc_HashKey2( Abc_Obj_t * p0, Abc_Obj_t * p1, int TableSize )
|
static unsigned Abc_HashKey2( Abc_Obj_t * p0, Abc_Obj_t * p1, int TableSize )
|
||||||
{
|
{
|
||||||
unsigned Key = 0;
|
unsigned Key = 0;
|
||||||
Key ^= Abc_ObjRegular(p0)->Id * 7937;
|
Key ^= (unsigned)Abc_ObjRegular(p0)->Id * 7937;
|
||||||
Key ^= Abc_ObjRegular(p1)->Id * 2971;
|
Key ^= (unsigned)Abc_ObjRegular(p1)->Id * 2971;
|
||||||
Key ^= Abc_ObjIsComplement(p0) * 911;
|
Key ^= (unsigned)Abc_ObjIsComplement(p0) * 911;
|
||||||
Key ^= Abc_ObjIsComplement(p1) * 353;
|
Key ^= (unsigned)Abc_ObjIsComplement(p1) * 353;
|
||||||
return Key % TableSize;
|
return Key % TableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue