]> granicus.if.org Git - re2c/commitdiff
Correctly set values on main diagonal of POSIX precedence matrix (configuration compa...
authorUlya Trofimovich <skvadrik@gmail.com>
Mon, 18 Feb 2019 10:52:26 +0000 (10:52 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Mon, 18 Feb 2019 10:52:26 +0000 (10:52 +0000)
It doesn't show any difference on the tests, probably because previously
these values were set to zero, which unpacks to symmetrical (though
incorrect) values, and thus doesn't affect comparison.

re2c/src/dfa/closure_posix.cc

index c17c1049c3fae2d4cc4576b229062f578a9d2b31..dcadd3bbd9cd654bea96cd364cbdfc200c455d43 100644 (file)
@@ -308,6 +308,7 @@ void orders(determ_context_t &ctx)
     const size_t nclos = closure.size();
 
     prectable_t *prectbl = ctx.dc_allocator.alloct<prectable_t>(nclos * nclos);
+    static const int32_t P0 = pack(MAX_RHO, 0);
 
     for (size_t i = 0; i < nclos; ++i) {
         for (size_t j = i + 1; j < nclos; ++j) {
@@ -316,7 +317,7 @@ void orders(determ_context_t &ctx)
             prectbl[i * nclos + j] = pack(rho1, l);
             prectbl[j * nclos + i] = pack(rho2, -l);
         }
-        prectbl[i * nclos + i] = 0;
+        prectbl[i * nclos + i] = P0;
     }
 
     ctx.dc_prectbl = prectbl;