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 Jun 19, 2019
1 parent ef9a5a7 commit e4a0709
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vt/epoch/epoch_manip.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ struct EpochManip {
);
static EpochType next(EpochType const& epoch);

/*
* Combine eEpochCategory elements
*/
static eEpochCategory makeCat(eEpochCategory c1, eEpochCategory c2);

private:
static EpochType nextSlow(EpochType const& epoch);
static EpochType nextFast(EpochType const& epoch);
Expand Down
8 changes: 8 additions & 0 deletions src/vt/epoch/epoch_manip_make.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ namespace vt { namespace epoch {
return epoch + 1;
}

/*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);
}

}} /* end namespace vt::epoch */

#endif /*INCLUDED_EPOCH_EPOCH_MANIP_MAKE_H*/

0 comments on commit e4a0709

Please sign in to comment.