mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-10 00:02:24 +03:00
allow sets of tops on edges
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -108,15 +108,10 @@ void contractVertex(NGHolder &g, NFAVertex v,
|
||||
}
|
||||
|
||||
static
|
||||
u32 findMaxInfixMatches(const NGHolder &h, const set<ue2_literal> &lits) {
|
||||
u32 findMaxLiteralMatches(const NGHolder &h, const set<ue2_literal> &lits) {
|
||||
DEBUG_PRINTF("h=%p, %zu literals\n", &h, lits.size());
|
||||
//dumpGraph("infix.dot", h.g);
|
||||
|
||||
if (!onlyOneTop(h)) {
|
||||
DEBUG_PRINTF("more than one top!n");
|
||||
return NO_MATCH_LIMIT;
|
||||
}
|
||||
|
||||
// Indices of vertices that could terminate any of the literals in 'lits'.
|
||||
set<u32> terms;
|
||||
|
||||
@@ -262,7 +257,11 @@ u32 findMaxInfixMatches(const left_id &left, const set<ue2_literal> &lits) {
|
||||
return findMaxInfixMatches(*left.castle(), lits);
|
||||
}
|
||||
if (left.graph()) {
|
||||
return findMaxInfixMatches(*left.graph(), lits);
|
||||
if (!onlyOneTop(*left.graph())) {
|
||||
DEBUG_PRINTF("more than one top!n");
|
||||
return NO_MATCH_LIMIT;
|
||||
}
|
||||
return findMaxLiteralMatches(*left.graph(), lits);
|
||||
}
|
||||
|
||||
return NO_MATCH_LIMIT;
|
||||
@@ -315,7 +314,7 @@ void findCountingMiracleInfo(const left_id &left, const vector<u8> &stopTable,
|
||||
lits.insert(ue2_literal(c, false));
|
||||
}
|
||||
|
||||
u32 count = findMaxInfixMatches(*left.graph(), lits);
|
||||
u32 count = findMaxLiteralMatches(*left.graph(), lits);
|
||||
DEBUG_PRINTF("counting miracle %u\n", count + 1);
|
||||
if (count && count < 50) {
|
||||
*cm_count = count + 1;
|
||||
|
Reference in New Issue
Block a user