From 1cbcf2e795818bc07381895b445988871cc771a9 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 5 Dec 2001 09:40:00 +0000 Subject: [PATCH] * src/closure.c (set_fderives): De-obfuscate. --- ChangeLog | 5 +++++ src/closure.c | 46 +++++++--------------------------------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18fba633..1b041ea6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-12-05 Akim Demaille + + * src/closure.c (set_fderives): De-obfuscate. + + 2001-12-05 Akim Demaille * src/closure.c (print_firsts, print_fderives): De-obfuscate. diff --git a/src/closure.c b/src/closure.c index 4b0a6ec0..83effa91 100644 --- a/src/closure.c +++ b/src/closure.c @@ -128,10 +128,7 @@ set_firsts (void) { int symbol = ritem[rule_table[derives[i][j]].rhs]; if (ISVAR (symbol)) - { - symbol -= ntokens; - SETBIT (FIRSTS (i - ntokens), symbol); - } + SETBIT (FIRSTS (i - ntokens), symbol - ntokens); } RTC (firsts, nvars); @@ -153,46 +150,17 @@ set_firsts (void) static void set_fderives (void) { - unsigned *rrow; - unsigned *vrow; - int j; - unsigned cword; - short *rp; - int b; - - int ruleno; - int i; + int i, j, k; fderives = XCALLOC (unsigned, nvars * rulesetsize) - ntokens * rulesetsize; set_firsts (); - rrow = FDERIVES (ntokens); - - for (i = ntokens; i < nsyms; i++) - { - vrow = FIRSTS (i - ntokens); - cword = *vrow++; - b = 0; - for (j = ntokens; j < nsyms; j++) - { - if (cword & (1 << b)) - { - rp = derives[j]; - while ((ruleno = *rp++) > 0) - SETBIT (rrow, ruleno); - } - - b++; - if (b >= BITS_PER_WORD && j + 1 < nsyms) - { - cword = *vrow++; - b = 0; - } - } - - rrow += rulesetsize; - } + for (i = ntokens; i < nsyms; ++i) + for (j = ntokens; j < nsyms; ++j) + if (BITISSET (FIRSTS (i - ntokens), j - ntokens)) + for (k = 0; derives[j][k] > 0; ++k) + SETBIT (FDERIVES (i), derives[j][k]); if (trace_flag) print_fderives (); -- 2.45.2