rose_build_groups: move getGroups, getSuccGroups

This commit is contained in:
Justin Viiret 2016-06-02 13:18:23 +10:00 committed by Matthew Barr
parent 42419a26d2
commit 70ef229b2b
2 changed files with 24 additions and 24 deletions

View File

@ -87,30 +87,6 @@ namespace ue2 {
#define ANCHORED_REHOME_DEEP 25 #define ANCHORED_REHOME_DEEP 25
#define ANCHORED_REHOME_SHORT_LEN 3 #define ANCHORED_REHOME_SHORT_LEN 3
rose_group RoseBuildImpl::getGroups(RoseVertex v) const {
rose_group groups = 0;
for (u32 id : g[v].literals) {
u32 lit_id = literal_info.at(id).undelayed_id;
rose_group mygroups = literal_info[lit_id].group_mask;
groups |= mygroups;
}
return groups;
}
/** \brief Get the groups of the successor literals of a given vertex. */
rose_group RoseBuildImpl::getSuccGroups(RoseVertex start) const {
rose_group initialGroups = 0;
for (auto v : adjacent_vertices_range(start, g)) {
initialGroups |= getGroups(v);
}
return initialGroups;
}
#ifdef DEBUG #ifdef DEBUG
static UNUSED static UNUSED
void printLitInfo(const rose_literal_info &li, u32 id) { void printLitInfo(const rose_literal_info &li, u32 id) {

View File

@ -335,6 +335,30 @@ void RoseBuildImpl::assignGroupsToLiterals() {
} }
} }
rose_group RoseBuildImpl::getGroups(RoseVertex v) const {
rose_group groups = 0;
for (u32 id : g[v].literals) {
u32 lit_id = literal_info.at(id).undelayed_id;
rose_group mygroups = literal_info[lit_id].group_mask;
groups |= mygroups;
}
return groups;
}
/** \brief Get the groups of the successor literals of a given vertex. */
rose_group RoseBuildImpl::getSuccGroups(RoseVertex start) const {
rose_group initialGroups = 0;
for (auto v : adjacent_vertices_range(start, g)) {
initialGroups |= getGroups(v);
}
return initialGroups;
}
/** /**
* The groups that a role sets are determined by the union of its successor * The groups that a role sets are determined by the union of its successor
* literals. Requires the literals already have had groups assigned. * literals. Requires the literals already have had groups assigned.