projects
/
Mograsim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
74206ee
)
ajusted or() behaviour when Z is input
author
Christian Femers
<femers@in.tum.de>
Tue, 14 May 2019 12:20:23 +0000
(14:20 +0200)
committer
Christian Femers
<femers@in.tum.de>
Tue, 14 May 2019 12:20:23 +0000
(14:20 +0200)
era.mi/src/era/mi/logic/Bit.java
patch
|
blob
|
history
diff --git
a/era.mi/src/era/mi/logic/Bit.java
b/era.mi/src/era/mi/logic/Bit.java
index
804ecc9
..
0e70985
100644
(file)
--- a/
era.mi/src/era/mi/logic/Bit.java
+++ b/
era.mi/src/era/mi/logic/Bit.java
@@
-13,12
+13,14
@@
public enum Bit
public Bit and(Bit other)
{
public Bit and(Bit other)
{
- if (equals(Bit.ZERO) || other.equals(Bit.ZERO))
- return Bit.ZERO;
- else if (equals(other) && equals(Bit.ONE))
- return Bit.ONE;
+ if (this == ZERO || other == ZERO)
+ return ZERO;
+ else if (this == other && this == ONE)
+ return ONE;
+ else if (this == X || other == X)
+ return X;
else
else
- return
Bit.X
;
+ return
ZERO
;
}
public static Bit or(Bit a, Bit b)
}
public static Bit or(Bit a, Bit b)
@@
-28,12
+30,14
@@
public enum Bit
public Bit or(Bit other)
{
public Bit or(Bit other)
{
- if (equals(Bit.ONE) || other.equals(Bit.ONE))
- return Bit.ONE;
- else if (equals(other) && equals(Bit.ZERO))
- return Bit.ZERO;
+ if (this == ONE || other == ONE)
+ return ONE;
+ else if (this == other && this == ZERO)
+ return ZERO;
+ else if (this == X || other == X)
+ return X;
else
else
- return
Bit.X
;
+ return
ZERO
;
}
public static Bit xor(Bit a, Bit b)
}
public static Bit xor(Bit a, Bit b)
@@
-43,11
+47,10
@@
public enum Bit
public Bit xor(Bit other)
{
public Bit xor(Bit other)
{
- if(this == Bit.X || this == Bit.Z
- || other == Bit.X || other == Bit.Z)
+ if(this == X || this == Z || other == X || other == Z)
return Bit.X;
else
return Bit.X;
else
- return this == other ?
Bit.ZERO : Bit.
ONE;
+ return this == other ?
ZERO :
ONE;
}
public Bit not()
}
public Bit not()