OSDN Git Service

Fix constant < > <= >= evaluation
authorRandy Heit <rheit@zdoom.fake>
Wed, 5 Feb 2014 02:21:51 +0000 (20:21 -0600)
committerRandy Heit <rheit@zdoom.fake>
Wed, 5 Feb 2014 02:21:51 +0000 (20:21 -0600)
- SendExprCommand() evaluated all four of these as their inverse. I
  wouldn't at all be surprised if this was caused by me fixing the
  undefined behavior (Which PopExStk() is called first?) and not
  even noticing that these were reversed because they popped off the stack
  in reverse order.

parse.c

diff --git a/parse.c b/parse.c
index e6d63f0..09c14b4 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -3806,19 +3806,19 @@ static void SendExprCommand(pcd_t pcd)
                        break;\r
                case PCD_LT:\r
                        operand2 = PopExStk();\r
-                       PushExStk(PopExStk() >= operand2);\r
+                       PushExStk(PopExStk() < operand2);\r
                        break;\r
                case PCD_GT:\r
                        operand2 = PopExStk();\r
-                       PushExStk(PopExStk() <= operand2);\r
+                       PushExStk(PopExStk() > operand2);\r
                        break;\r
                case PCD_LE:\r
                        operand2 = PopExStk();\r
-                       PushExStk(PopExStk() > operand2);\r
+                       PushExStk(PopExStk() <= operand2);\r
                        break;\r
                case PCD_GE:\r
                        operand2 = PopExStk();\r
-                       PushExStk(PopExStk() < operand2);\r
+                       PushExStk(PopExStk() >= operand2);\r
                        break;\r
                case PCD_ANDLOGICAL:\r
                        operand2 = PopExStk();\r