]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
mcclellan: fix dump issue in wide-state case.
authorHong, Yang A <yang.a.hong@intel.com>
Thu, 17 Jan 2019 16:20:06 +0000 (00:20 +0800)
committerChang, Harry <harry.chang@intel.com>
Mon, 21 Jan 2019 01:59:29 +0000 (09:59 +0800)
src/nfa/mcclellandump.cpp

index a13795fd30dabe56d6774113a354b9e591435e1c..92090bc52ba6af9e084e44054717bd26efe00f63 100644 (file)
@@ -275,7 +275,8 @@ void nfaExecMcClellan16_dumpDot(const NFA *nfa, FILE *f) {
 
     dumpDotPreambleDfa(f);
 
-    for (u16 i = 1; i < m->state_count; i++) {
+    u16 sherman_ceil = m->has_wide == 1 ? m->wide_limit : m->state_count;
+    for (u16 i = 1; i < sherman_ceil; i++) {
         describeNode(nfa, m, i, f);
 
         u16 t[ALPHABET_SIZE];
@@ -314,7 +315,8 @@ void dumpAccelMasks(FILE *f, const mcclellan *m, const mstate_aux *aux) {
     fprintf(f, "Acceleration\n");
     fprintf(f, "------------\n");
 
-    for (u16 i = 0; i < m->state_count; i++) {
+    u16 sherman_ceil = m->has_wide == 1 ? m->wide_limit : m->state_count;
+    for (u16 i = 0; i < sherman_ceil; i++) {
         if (!aux[i].accel_offset) {
             continue;
         }
@@ -360,7 +362,8 @@ void dumpCommonHeader(FILE *f, const mcclellan *m) {
 static
 void dumpTransitions(FILE *f, const NFA *nfa, const mcclellan *m,
                      const mstate_aux *aux) {
-    for (u16 i = 0; i < m->state_count; i++) {
+    u16 sherman_ceil = m->has_wide == 1 ? m->wide_limit : m->state_count;
+    for (u16 i = 0; i < sherman_ceil; i++) {
         fprintf(f, "%05hu", i);
         if (aux[i].accel_offset) {
             dumpAccelText(f, (const union AccelAux *)((const char *)m +