mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 03:34:25 +03:00
depth: make constructor explicit
This commit is contained in:
committed by
Matthew Barr
parent
37cb93e60f
commit
cf82924a39
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -208,7 +208,7 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
|
||||
|
||||
/* get bounds */
|
||||
depth min;
|
||||
depth max = 1;
|
||||
depth max(1);
|
||||
|
||||
if (selfLoop) {
|
||||
// A self-loop indicates that this is a '.+' or '.*'
|
||||
@@ -229,9 +229,9 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
|
||||
}
|
||||
}
|
||||
|
||||
min = 0;
|
||||
min = depth(0);
|
||||
} else {
|
||||
min = 1;
|
||||
min = depth(1);
|
||||
}
|
||||
|
||||
*startBegin = min;
|
||||
@@ -326,8 +326,8 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
|
||||
}
|
||||
|
||||
/* get bounds */
|
||||
depth min = 1;
|
||||
depth max = 1;
|
||||
depth min(1);
|
||||
depth max(1);
|
||||
|
||||
if (selfLoop) {
|
||||
// A self-loop indicates that this is a '.+' or '.*'
|
||||
@@ -349,7 +349,7 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
|
||||
DEBUG_PRINTF("min greater than one, skipping\n");
|
||||
return;
|
||||
}
|
||||
min = 0;
|
||||
min = depth(0);
|
||||
}
|
||||
|
||||
*startBegin += min;
|
||||
@@ -502,7 +502,7 @@ void collapseVariableDotRepeat(NGHolder &g, NFAVertex start,
|
||||
startEnd->str().c_str());
|
||||
|
||||
if (start == g.start && startEnd->is_infinite()) {
|
||||
*startEnd = dots.size();
|
||||
*startEnd = depth(dots.size());
|
||||
} else if (startEnd->is_finite()) {
|
||||
*startEnd += dots.size();
|
||||
}
|
||||
|
@@ -372,15 +372,16 @@ deque<unique_ptr<NGHolder>> calcComponents(unique_ptr<NGHolder> g,
|
||||
}
|
||||
|
||||
bool shell_comp = false;
|
||||
splitIntoComponents(std::move(g), comps, MAX_HEAD_SHELL_DEPTH,
|
||||
MAX_TAIL_SHELL_DEPTH, &shell_comp);
|
||||
splitIntoComponents(std::move(g), comps, depth(MAX_HEAD_SHELL_DEPTH),
|
||||
depth(MAX_TAIL_SHELL_DEPTH), &shell_comp);
|
||||
|
||||
if (shell_comp) {
|
||||
DEBUG_PRINTF("re-running on shell comp\n");
|
||||
assert(!comps.empty());
|
||||
auto sc = std::move(comps.back());
|
||||
comps.pop_back();
|
||||
splitIntoComponents(std::move(sc), comps, 0, 0, &shell_comp);
|
||||
splitIntoComponents(std::move(sc), comps, depth(0), depth(0),
|
||||
&shell_comp);
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("finished; split into %zu components\n", comps.size());
|
||||
|
@@ -84,7 +84,7 @@ void checkVertex(const ReportManager &rm, const NGHolder &g, NFAVertex v,
|
||||
return;
|
||||
}
|
||||
if (is_any_start(v, g)) {
|
||||
info.min = 0;
|
||||
info.min = depth(0);
|
||||
info.max = max(info.max, depth(0));
|
||||
return;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -26,7 +26,8 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
/**
|
||||
* \file
|
||||
* \brief Prefilter Reductions.
|
||||
*
|
||||
* This file contains routines for reducing the size of an NFA graph that we
|
||||
@@ -92,13 +93,13 @@ struct RegionInfo {
|
||||
u32 id; //!< region id
|
||||
deque<NFAVertex> vertices; //!< vertices in the region
|
||||
CharReach reach; //!< union of region reach
|
||||
depth minWidth = 0; //!< min width of region subgraph
|
||||
depth maxWidth = depth::infinity(); //!< max width of region subgraph
|
||||
depth minWidth{0}; //!< min width of region subgraph
|
||||
depth maxWidth{depth::infinity()}; //!< max width of region subgraph
|
||||
bool atBoundary = false; //!< region is next to an accept
|
||||
|
||||
// Bigger score is better.
|
||||
size_t score() const {
|
||||
// FIXME: charreach should be a signal?
|
||||
// TODO: charreach should be a signal?
|
||||
size_t numVertices = vertices.size();
|
||||
if (atBoundary) {
|
||||
return numVertices - min(PENALTY_BOUNDARY, numVertices);
|
||||
|
@@ -105,8 +105,8 @@ typedef boost::filtered_graph<NGHolder, ReachFilter<NGHolder>> RepeatGraph;
|
||||
|
||||
struct ReachSubgraph {
|
||||
vector<NFAVertex> vertices;
|
||||
depth repeatMin = 0;
|
||||
depth repeatMax = 0;
|
||||
depth repeatMin{0};
|
||||
depth repeatMax{0};
|
||||
u32 minPeriod = 1;
|
||||
bool is_reset = false;
|
||||
enum RepeatType historyType = REPEAT_RING;
|
||||
@@ -586,8 +586,8 @@ bool processSubgraph(const NGHolder &g, ReachSubgraph &rsi,
|
||||
range.first, range.second);
|
||||
return false;
|
||||
}
|
||||
rsi.repeatMin = range.first;
|
||||
rsi.repeatMax = range.second;
|
||||
rsi.repeatMin = depth(range.first);
|
||||
rsi.repeatMax = depth(range.second);
|
||||
|
||||
// If we've got a self-loop anywhere, we've got inf max.
|
||||
if (anySelfLoop(g, rsi.vertices.begin(), rsi.vertices.end())) {
|
||||
@@ -2106,7 +2106,7 @@ void populateFixedTopInfo(const map<u32, u32> &fixed_depth_tops,
|
||||
td = depth::infinity();
|
||||
break;
|
||||
}
|
||||
depth td_t = fixed_depth_tops.at(top);
|
||||
depth td_t(fixed_depth_tops.at(top));
|
||||
if (td == td_t) {
|
||||
continue;
|
||||
} else if (td == depth::infinity()) {
|
||||
@@ -2479,7 +2479,7 @@ bool isPureRepeat(const NGHolder &g, PureRepeat &repeat) {
|
||||
// have the same report set as the vertices in the repeat.
|
||||
if (repeat.bounds.min == depth(1) &&
|
||||
g[g.start].reports == g[v].reports) {
|
||||
repeat.bounds.min = 0;
|
||||
repeat.bounds.min = depth(0);
|
||||
DEBUG_PRINTF("graph is %s repeat\n", repeat.bounds.str().c_str());
|
||||
} else {
|
||||
DEBUG_PRINTF("not a supported repeat\n");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -94,7 +94,7 @@ vector<DepthMinMax> getDistancesFromSOM(const NGHolder &g_orig) {
|
||||
|
||||
if (v_orig == g_orig.startDs || is_virtual_start(v_orig, g_orig)) {
|
||||
// StartDs and virtual starts always have zero depth.
|
||||
d = DepthMinMax(0, 0);
|
||||
d = DepthMinMax(depth(0), depth(0));
|
||||
} else {
|
||||
u32 new_idx = g[v_new].index;
|
||||
d = temp_depths.at(new_idx);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -157,12 +157,12 @@ depth findMaxWidth(const NGHolder &h, const SpecialEdgeFilter &filter,
|
||||
if (colors.at(NODE_ACCEPT) == boost::white_color) {
|
||||
acceptDepth = depth::unreachable();
|
||||
} else {
|
||||
acceptDepth = -1 * distance.at(NODE_ACCEPT);
|
||||
acceptDepth = depth(-1 * distance.at(NODE_ACCEPT));
|
||||
}
|
||||
if (colors.at(NODE_ACCEPT_EOD) == boost::white_color) {
|
||||
acceptEodDepth = depth::unreachable();
|
||||
} else {
|
||||
acceptEodDepth = -1 * distance.at(NODE_ACCEPT_EOD);
|
||||
acceptEodDepth = depth(-1 * distance.at(NODE_ACCEPT_EOD));
|
||||
}
|
||||
|
||||
depth d;
|
||||
|
Reference in New Issue
Block a user