[PATCH 1/9] change testing of signed compares against SMIN or SMAX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These tests are written by testing if the comparisons are equal
to their expected value: 0 or 1. So, a compare of a compare
but such compares of compare have their own simplification
which defeats what's tested here.

So, rewrite the test to avoid such compares of compare.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/cmps-minmax.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/validation/optim/cmps-minmax.c b/validation/optim/cmps-minmax.c
index 5802cdbcafd1..0b1a0a099d7d 100644
--- a/validation/optim/cmps-minmax.c
+++ b/validation/optim/cmps-minmax.c
@@ -1,11 +1,11 @@
 #define SMAX __INT_MAX__
 #define SMIN (-__INT_MAX__-1)
 
-int lt_smin(int a) { return (a <  SMIN) == 0; }
-int le_smax(int a) { return (a <= SMAX) == 1; }
+int lt_smin(int a) { return (a <  SMIN) + 1; }
+int le_smax(int a) { return (a <= SMAX) + 0; }
 
-int ge_smin(int a) { return (a >= SMIN) == 1; }
-int gt_smax(int a) { return (a >  SMAX) == 0; }
+int ge_smin(int a) { return (a >= SMIN) + 0; }
+int gt_smax(int a) { return (a >  SMAX) + 1; }
 
 /*
  * check-name: cmps-minmax
-- 
2.30.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux