From 1d511e8ab8bc19d8bf9ad52a2992f87fc8303c21 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 2 Jun 1999 20:20:55 +0000 Subject: [PATCH] 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 --- jode/jode/expr/CompareBinaryOperator.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jode/jode/expr/CompareBinaryOperator.java b/jode/jode/expr/CompareBinaryOperator.java index e708737..a6806f9 100644 --- a/jode/jode/expr/CompareBinaryOperator.java +++ b/jode/jode/expr/CompareBinaryOperator.java @@ -22,6 +22,7 @@ import jode.type.Type; import jode.decompiler.TabbedPrintWriter; public class CompareBinaryOperator extends Operator { + boolean allowsNaN = false; Type compareType; public CompareBinaryOperator(Type type, int op) { @@ -30,6 +31,13 @@ public class CompareBinaryOperator extends Operator { initOperands(2); } + public CompareBinaryOperator(Type type, int op, boolean allowsNaN) { + super(Type.tBoolean, op); + compareType = type; + this.allowsNaN = allowsNaN; + initOperands(2); + } + public int getPriority() { switch (getOperatorIndex()) { case 26: @@ -62,8 +70,7 @@ public class CompareBinaryOperator extends Operator { } public Expression negate() { - if ((getType() != Type.tFloat && getType() != Type.tDouble) - || getOperatorIndex() <= NOTEQUALS_OP) { + if (!allowsNaN || getOperatorIndex() <= NOTEQUALS_OP) { setOperatorIndex(getOperatorIndex() ^ 1); return this; }