]> git.saurik.com Git - bison.git/commitdiff
* src/output.c (action_row): De-obfuscate
authorAkim Demaille <akim@epita.fr>
Wed, 5 Dec 2001 09:22:14 +0000 (09:22 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 5 Dec 2001 09:22:14 +0000 (09:22 +0000)
using the good o' techniques: arrays not pointers, variable
locality, BITISSET, RESETBIT etc.

ChangeLog
src/output.c

index 1212dc3a3cc4865ccb8359ce756fea561a565c6c..e9b3ab11871c3aacf8947bb5fa2ae0b678d00812 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-12-05  Akim Demaille  <akim@epita.fr>
+
+       * src/output.c (action_row): De-obfuscate
+       using the good o' techniques: arrays not pointers, variable
+       locality, BITISSET, RESETBIT etc.
+
+       
 2001-12-05  Akim Demaille  <akim@epita.fr>
 
        Pessimize the code to simplify it: from now on, all the states
 2001-12-05  Akim Demaille  <akim@epita.fr>
 
        Pessimize the code to simplify it: from now on, all the states
index c2ee8702ee942aecd3487758f331b8bb3cfc263d..053cab5b44ced8a75ae5c7d6b8f3bcbcb37347d3 100644 (file)
@@ -529,15 +529,11 @@ action_row (int state)
   int k;
   int m = 0;
   int n = 0;
   int k;
   int m = 0;
   int n = 0;
-  int count;
   int default_rule;
   int nreds;
   int default_rule;
   int nreds;
-  int max;
   int rule;
   int shift_state;
   int symbol;
   int rule;
   int shift_state;
   int symbol;
-  unsigned mask;
-  unsigned *wordp;
   reductions *redp;
   shifts *shiftp;
   errs *errp;
   reductions *redp;
   shifts *shiftp;
   errs *errp;
@@ -562,28 +558,13 @@ action_row (int state)
          n = state_table[state + 1].lookaheads;
 
          for (i = n - 1; i >= m; i--)
          n = state_table[state + 1].lookaheads;
 
          for (i = n - 1; i >= m; i--)
-           {
-             rule = -LAruleno[i];
-             wordp = LA (i);
-             mask = 1;
-
-             /* and find each token which the rule finds acceptable
-                to come next */
-             for (j = 0; j < ntokens; j++)
-               {
-                 /* and record this rule as the rule to use if that
-                    token follows.  */
-                 if (mask & *wordp)
-                   actrow[j] = rule;
-
-                 mask <<= 1;
-                 if (mask == 0)
-                   {
-                     mask = 1;
-                     wordp++;
-                   }
-               }
-           }
+           /* and find each token which the rule finds acceptable
+              to come next */
+           for (j = 0; j < ntokens; j++)
+             /* and record this rule as the rule to use if that
+                token follows.  */
+             if (BITISSET (LA (i), j))
+               actrow[j] = -LAruleno[i];
        }
     }
 
        }
     }
 
@@ -591,7 +572,6 @@ action_row (int state)
      them, record the shift as the thing to do.  So shift is preferred
      to reduce.  */
   shiftp = state_table[state].shift_table;
      them, record the shift as the thing to do.  So shift is preferred
      to reduce.  */
   shiftp = state_table[state].shift_table;
-
   for (i = 0; i < shiftp->nshifts; i++)
     {
       shift_state = shiftp->shifts[i];
   for (i = 0; i < shiftp->nshifts; i++)
     {
       shift_state = shiftp->shifts[i];
@@ -635,10 +615,10 @@ action_row (int state)
        default_rule = redp->rules[0];
       else
        {
        default_rule = redp->rules[0];
       else
        {
-         max = 0;
+         int max = 0;
          for (i = m; i < n; i++)
            {
          for (i = m; i < n; i++)
            {
-             count = 0;
+             int count = 0;
              rule = -LAruleno[i];
 
              for (j = 0; j < ntokens; j++)
              rule = -LAruleno[i];
 
              for (j = 0; j < ntokens; j++)