summaryrefslogtreecommitdiff
path: root/chapter17/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'chapter17/src/main/java')
-rw-r--r--chapter17/src/main/java/com/seaofnodes/simple/node/MinusNode.java2
-rw-r--r--chapter17/src/main/java/com/seaofnodes/simple/node/NotNode.java3
2 files changed, 3 insertions, 2 deletions
diff --git a/chapter17/src/main/java/com/seaofnodes/simple/node/MinusNode.java b/chapter17/src/main/java/com/seaofnodes/simple/node/MinusNode.java
index 50377061..a9e21814 100644
--- a/chapter17/src/main/java/com/seaofnodes/simple/node/MinusNode.java
+++ b/chapter17/src/main/java/com/seaofnodes/simple/node/MinusNode.java
@@ -25,7 +25,7 @@ public class MinusNode extends Node {
return TypeInteger.BOT;
return TypeInteger.make(-i0._max,-i0._min);
}
- return TypeInteger.TOP.meet(in(1)._type);
+ return in(1)._type.isHigh() ? TypeInteger.TOP : TypeInteger.BOT;
}
@Override
diff --git a/chapter17/src/main/java/com/seaofnodes/simple/node/NotNode.java b/chapter17/src/main/java/com/seaofnodes/simple/node/NotNode.java
index cca84a2d..3f4b291c 100644
--- a/chapter17/src/main/java/com/seaofnodes/simple/node/NotNode.java
+++ b/chapter17/src/main/java/com/seaofnodes/simple/node/NotNode.java
@@ -21,7 +21,8 @@ public class NotNode extends Node {
if( t0.isHigh() ) return TypeInteger.BOOL.dual();
switch( t0 ) {
case TypeInteger i0: return i0._max < 0 || i0._min > 0 ? TypeInteger.FALSE : (i0==TypeInteger.ZERO ? TypeInteger.TRUE : TypeInteger.BOOL);
- case TypeFloat i0: return i0.isConstant() ? TypeInteger.constant(i0.value()==0 ? 1 : 0) : i0;
+ case TypeFloat i0:
+ return i0.isConstant() ? TypeInteger.constant(i0.value()==0 ? 1 : 0) : TypeInteger.BOOL;
case TypeMemPtr p0:
// top->top, bot->bot, null->1, *void->0, not-null ptr->0, ptr/nil->bot
// If input in null then true