Fix a floating point comparison bug - Gets simple SWT examples to work on

Mac OS X
This commit is contained in:
Eric Scharff 2007-10-04 10:21:14 -06:00
parent ace36f1b15
commit a9fcb59e6c

View File

@ -1253,14 +1253,30 @@ interpret(Thread* t)
float b = popFloat(t); float b = popFloat(t);
float a = popFloat(t); float a = popFloat(t);
pushInt(t, (a > b ? 1 : 0)); if (a < b) {
pushInt(t, static_cast<unsigned>(-1));
} else if (a > b) {
pushInt(t, 1);
} else if (a == b) {
pushInt(t, 0);
} else {
pushInt(t, 1);
}
} goto loop; } goto loop;
case fcmpl: { case fcmpl: {
float b = popFloat(t); float b = popFloat(t);
float a = popFloat(t); float a = popFloat(t);
pushInt(t, (a < b ? 1 : 0)); if (a < b) {
pushInt(t, static_cast<unsigned>(-1));
} else if (a > b) {
pushInt(t, 1);
} else if (a == b) {
pushInt(t, 0);
} else {
pushInt(t, static_cast<unsigned>(-1));
}
} goto loop; } goto loop;
case fconst_0: { case fconst_0: {