[hackers] [scc] Add more identities for shift operators || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 5 Sep 2015 19:59:17 +0200 (CEST)

commit c40ecd533a2317a3db0b29c3ecdc6ffd0d8baeb4
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Sep 5 19:58:46 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Sep 5 19:58:46 2015 +0200

    Add more identities for shift operators

diff --git a/cc1/fold.c b/cc1/fold.c
index bb4a16a..17a6572 100644
--- a/cc1/fold.c
+++ b/cc1/fold.c
_AT_@ -423,13 +423,20 @@ identity(int *op, Node *lp, Node *rp)
                 return NULL;
         case OSHL:
         case OSHR:
+ /*
+ * i >> 0 => i (free right)
+ * i << 0 => i (free right)
+ * 0 >> i => 0 (free right)
+ * 0 << i => 0 (free right)
+ */
+ if (iszeror | iszerol)
+ goto free_right;
+ return NULL;
         case OBXOR:
         case OADD:
         case OBOR:
         case OSUB:
                 /*
- * i >> 0 => i
- * i << 0 => i
                  * i + 0 => i
                  * i - 0 => i
                  * i | 0 => i
Received on Sat Sep 05 2015 - 19:59:17 CEST

This archive was generated by hypermail 2.3.0 : Sat Sep 05 2015 - 20:00:14 CEST