From 8823a8fbfdaeff4a9e2d7f17d2f5063391b9013b Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Tue, 14 Mar 2017 18:43:42 +1100 Subject: [PATCH] ng_region: use flat_sets in exit_info --- src/nfagraph/ng_region.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nfagraph/ng_region.cpp b/src/nfagraph/ng_region.cpp index 0ecd7bd6..39c0f683 100644 --- a/src/nfagraph/ng_region.cpp +++ b/src/nfagraph/ng_region.cpp @@ -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: @@ -79,7 +79,7 @@ struct exit_info { explicit exit_info(NFAVertex v) : exit(v) {} NFAVertex exit; - ue2::unordered_set open; + flat_set open; }; } @@ -88,7 +88,7 @@ void checkAndAddExitCandidate(const AcyclicGraph &g, const ue2::unordered_set &r, NFAVertex v, vector *exits) { // set when we find our first candidate. - ue2::unordered_set *open = nullptr; + decltype(exit_info::open) *open = nullptr; /* find the set of vertices reachable from v which are not in r */ for (auto w : adjacent_vertices_range(v, g)) { @@ -136,7 +136,7 @@ void refineExits(const AcyclicGraph &g, const ue2::unordered_set &r, */ static bool exitValid(UNUSED const AcyclicGraph &g, const vector &exits, - const ue2::unordered_set &open_jumps) { + const flat_set &open_jumps) { if (exits.empty() || (exits.size() < 2 && open_jumps.empty())) { return true; } @@ -180,7 +180,7 @@ void buildInitialCandidate(const AcyclicGraph &g, /* in exits of prev region; * out exits from candidate */ vector *exits, - ue2::unordered_set *open_jumps) { + flat_set *open_jumps) { if (it == ite) { candidate->clear(); exits->clear(); @@ -198,7 +198,7 @@ void buildInitialCandidate(const AcyclicGraph &g, return; } - ue2::unordered_set enters = (*exits)[0].open; + auto enters = (*exits)[0].open; // copy candidate->clear(); for (; it != ite; ++it) { @@ -211,7 +211,7 @@ void buildInitialCandidate(const AcyclicGraph &g, if (it != ite) { enters.erase(*it); - open_jumps->swap(enters); + *open_jumps = move(enters); DEBUG_PRINTF("oj size = %zu\n", open_jumps->size()); ++it; } else { @@ -230,7 +230,7 @@ void findDagLeaders(const NGHolder &h, const AcyclicGraph &g, vector::const_reverse_iterator t_it = topo.rbegin(); vector exits; ue2::unordered_set candidate; - ue2::unordered_set open_jumps; + flat_set open_jumps; DEBUG_PRINTF("adding %zu to current\n", g[*t_it].index); assert(t_it != topo.rend()); candidate.insert(*t_it++);