V0.8: fix verinum XOR with z input

This patch mirrors what was done in development to fix the XOR
of a z bit in verinum.
This commit is contained in:
Cary R 2008-11-21 17:21:08 -08:00 committed by Stephen Williams
parent d134f6f074
commit c8bffe728a
2 changed files with 5 additions and 2 deletions

View File

@ -997,9 +997,9 @@ verinum::V operator & (verinum::V l, verinum::V r)
verinum::V operator ^ (verinum::V l, verinum::V r)
{
if (l == verinum::V0)
return r;
return bit4_z2x(r);
if (r == verinum::V0)
return l;
return bit4_z2x(l);
if ((l == verinum::V1) && (r == verinum::V1))
return verinum::V0;

View File

@ -113,6 +113,9 @@ extern verinum trim_vnum(const verinum&);
extern std::ostream& operator<< (std::ostream&, const verinum&);
extern std::ostream& operator<< (std::ostream&, verinum::V);
inline verinum::V bit4_z2x(verinum::V bit)
{ return bit<2? bit : verinum::Vx; /* Relies on V0 and V1 being <2 */}
extern verinum::V operator ~ (verinum::V l);
extern verinum::V operator | (verinum::V l, verinum::V r);
extern verinum::V operator & (verinum::V l, verinum::V r);