\r
public Bit and(Bit other)\r
{\r
- if (equals(Bit.ZERO) || other.equals(Bit.ZERO))\r
- return Bit.ZERO;\r
- else if (equals(other) && equals(Bit.ONE))\r
- return Bit.ONE;\r
+ if (this == ZERO || other == ZERO)\r
+ return ZERO;\r
+ else if (this == other && this == ONE)\r
+ return ONE;\r
+ else if (this == X || other == X)\r
+ return X;\r
else\r
- return Bit.X;\r
+ return ZERO;\r
}\r
\r
public static Bit or(Bit a, Bit b)\r
\r
public Bit or(Bit other)\r
{\r
- if (equals(Bit.ONE) || other.equals(Bit.ONE))\r
- return Bit.ONE;\r
- else if (equals(other) && equals(Bit.ZERO))\r
- return Bit.ZERO;\r
+ if (this == ONE || other == ONE)\r
+ return ONE;\r
+ else if (this == other && this == ZERO)\r
+ return ZERO;\r
+ else if (this == X || other == X)\r
+ return X;\r
else\r
- return Bit.X;\r
+ return ZERO;\r
}\r
\r
public static Bit xor(Bit a, Bit b)\r
\r
public Bit xor(Bit other)\r
{\r
- if(this == Bit.X || this == Bit.Z\r
- || other == Bit.X || other == Bit.Z)\r
+ if(this == X || this == Z || other == X || other == Z)\r
return Bit.X;\r
else\r
- return this == other ? Bit.ZERO : Bit.ONE;\r
+ return this == other ? ZERO : ONE;\r
}\r
\r
public Bit not()\r