]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
find_better_daddy: position change
authorHong, Yang A <yang.a.hong@intel.com>
Mon, 28 Aug 2017 19:42:46 +0000 (03:42 +0800)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 18 Sep 2017 03:31:09 +0000 (13:31 +1000)
src/nfa/mcclellancompile.cpp

index ff18a68af7d46a5fba31e97e423f7981c28ab667..d705ddf919e15d0c3ddfb30e4cfa7a122719f641 100644 (file)
@@ -940,7 +940,6 @@ bytecode_ptr<NFA> mcclellanCompile_i(raw_dfa &raw, accel_dfa_build_strat &strat,
                                      set<dstate_id_t> *accel_states) {
     assert(!is_dead(raw));
 
-    u16 total_daddy = 0;
     dfa_info info(strat);
     bool using8bit = cc.grey.allowMcClellan8 && info.size() <= 256;
 
@@ -950,21 +949,24 @@ bytecode_ptr<NFA> mcclellanCompile_i(raw_dfa &raw, accel_dfa_build_strat &strat,
     }
 
     bool has_eod_reports = raw.hasEodReports();
-    bool any_cyclic_near_anchored_state = is_cyclic_near(raw,
-                                                         raw.start_anchored);
-
-    for (u32 i = 0; i < info.size(); i++) {
-        find_better_daddy(info, i, using8bit, any_cyclic_near_anchored_state,
-                          trust_daddy_states, cc.grey);
-        total_daddy += info.extra[i].daddytaken;
-    }
-
-    DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
-                 info.size() * info.impl_alpha_size, info.size(),
-                 info.impl_alpha_size);
 
     bytecode_ptr<NFA> nfa;
     if (!using8bit) {
+        u16 total_daddy = 0;
+        bool any_cyclic_near_anchored_state
+            = is_cyclic_near(raw, raw.start_anchored);
+
+        for (u32 i = 0; i < info.size(); i++) {
+            find_better_daddy(info, i, using8bit,
+                              any_cyclic_near_anchored_state,
+                              trust_daddy_states, cc.grey);
+            total_daddy += info.extra[i].daddytaken;
+        }
+
+        DEBUG_PRINTF("daddy %hu/%zu states=%zu alpha=%hu\n", total_daddy,
+                     info.size() * info.impl_alpha_size, info.size(),
+                     info.impl_alpha_size);
+
         nfa = mcclellanCompile16(info, cc, accel_states);
     } else {
         nfa = mcclellanCompile8(info, cc, accel_states);