added allowsNaN check

fixed a bug with NaN


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@823 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 4f3f294b7c
commit 1d511e8ab8
  1. 11
      jode/jode/expr/CompareBinaryOperator.java

@ -22,6 +22,7 @@ import jode.type.Type;
import jode.decompiler.TabbedPrintWriter; import jode.decompiler.TabbedPrintWriter;
public class CompareBinaryOperator extends Operator { public class CompareBinaryOperator extends Operator {
boolean allowsNaN = false;
Type compareType; Type compareType;
public CompareBinaryOperator(Type type, int op) { public CompareBinaryOperator(Type type, int op) {
@ -30,6 +31,13 @@ public class CompareBinaryOperator extends Operator {
initOperands(2); initOperands(2);
} }
public CompareBinaryOperator(Type type, int op, boolean allowsNaN) {
super(Type.tBoolean, op);
compareType = type;
this.allowsNaN = allowsNaN;
initOperands(2);
}
public int getPriority() { public int getPriority() {
switch (getOperatorIndex()) { switch (getOperatorIndex()) {
case 26: case 26:
@ -62,8 +70,7 @@ public class CompareBinaryOperator extends Operator {
} }
public Expression negate() { public Expression negate() {
if ((getType() != Type.tFloat && getType() != Type.tDouble) if (!allowsNaN || getOperatorIndex() <= NOTEQUALS_OP) {
|| getOperatorIndex() <= NOTEQUALS_OP) {
setOperatorIndex(getOperatorIndex() ^ 1); setOperatorIndex(getOperatorIndex() ^ 1);
return this; return this;
} }

Loading…
Cancel
Save