From e4a07096c5f8dc92b5ecabfbf8f3214394207ce6 Mon Sep 17 00:00:00 2001 From: Jonathan Lifflander Date: Wed, 19 Jun 2019 16:34:18 -0700 Subject: [PATCH] #410: epoch: add function to bit-combine epoch category bits --- src/vt/epoch/epoch_manip.h | 5 +++++ src/vt/epoch/epoch_manip_make.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/vt/epoch/epoch_manip.h b/src/vt/epoch/epoch_manip.h index b832a51be5..ec1a242ec3 100644 --- a/src/vt/epoch/epoch_manip.h +++ b/src/vt/epoch/epoch_manip.h @@ -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); diff --git a/src/vt/epoch/epoch_manip_make.h b/src/vt/epoch/epoch_manip_make.h index 8c30432ccf..d7eedc17cf 100644 --- a/src/vt/epoch/epoch_manip_make.h +++ b/src/vt/epoch/epoch_manip_make.h @@ -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::type; + auto ret = static_cast(c1) | static_cast(c2); + return static_cast(ret); +} + }} /* end namespace vt::epoch */ #endif /*INCLUDED_EPOCH_EPOCH_MANIP_MAKE_H*/