Skip to content

Commit

Permalink
#410: epoch: add function to bit-combine epoch category bits
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Oct 18, 2023
1 parent ccd5afd commit b393469
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/vt/epoch/epoch_manip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ void EpochManip::setCategory(EpochType& epoch, eEpochCategory const cat) {
>(*epoch,cat);
}

/*static*/ inline eEpochCategory EpochManip::makeCat(
eEpochCategory c1, eEpochCategory c2
) {
using T = typename std::underlying_type<eEpochCategory>::type;
auto ret = static_cast<T>(c1) | static_cast<T>(c2);
return static_cast<eEpochCategory>(ret);
}

/*static*/
void EpochManip::setNode(EpochType& epoch, NodeType const node) {
vtAssert(isRooted(epoch), "Must be rooted to manipulate the node");
Expand Down
8 changes: 8 additions & 0 deletions src/vt/epoch/epoch_manip.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ struct EpochManip : runtime::component::Component<EpochManip> {
*/
static void setSeq(EpochType& epoch, EpochType::ImplType const seq);

/**
* \brief Combine eEpochCategory elements
*
* \param[in] c1 category 1
* \param[in] c2 category 2
*/
static eEpochCategory makeCat(eEpochCategory c1, eEpochCategory c2);

/*
* General (stateless) methods for creating a epoch with certain properties
* based on a current sequence number
Expand Down

0 comments on commit b393469

Please sign in to comment.