URI:
       cc1: Move power2node() out of modulo reduction - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit a8dae969ea1800fd5f3f247cc3cc7c91f10be260
   DIR parent c33ee56f6924c8e0f4a06fd7c1d7e0b457660781
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
       Date:   Tue, 24 Mar 2026 09:30:36 +0100
       
       cc1: Move power2node() out of modulo reduction
       
       As new reductions are going to be added and they are going to be based
       in the logarithm of the power of 2 it makes sense to have only one call
       to power2node().
       
       Diffstat:
         M src/cmd/scc-cc/cc1/fold.c           |      13 ++++++-------
       
       1 file changed, 6 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/src/cmd/scc-cc/cc1/fold.c b/src/cmd/scc-cc/cc1/fold.c
       @@ -795,20 +795,19 @@ reduce(Node *np)
        {
                Node *lp = np->left, *rp = np->right;
                Node *aux, *aux2;
       -        int op = np->op;
       +        int log, op = np->op;
        
                if (np->type->prop & TSIGNED)
                        return;
       +        if (!power2node(rp, &log))
       +                return;
        
                switch (op) {
                case OMOD:
                        /* i % 2^n => i & n-1 */
       -                if (power2node(rp, NULL)) {
       -                        np->op = OBAND;
       -                        rp->sym->u.u--;
       -                        break;
       -                }
       -                return;
       +                np->op = OBAND;
       +                rp->sym->u.u--;
       +                break;
                default:
                        return;
                }