aboutsummaryrefslogtreecommitdiffstats
path: root/chilbert/Operations.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'chilbert/Operations.hpp')
-rw-r--r--chilbert/Operations.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/chilbert/Operations.hpp b/chilbert/Operations.hpp
index 5781e6c..3b9dd53 100644
--- a/chilbert/Operations.hpp
+++ b/chilbert/Operations.hpp
@@ -35,6 +35,22 @@ using IntegralIndex = std::enable_if_t<std::is_integral<T>::value, size_t>;
template <typename T>
using BitsetIndex = std::enable_if_t<!std::is_integral<T>::value, size_t>;
+/// Reset all bits in `field`
+template <typename T>
+std::enable_if_t<std::is_integral<T>::value>
+resetBits(T& field)
+{
+ field = static_cast<T>(0);
+}
+
+/// Reset all bits in `field`
+template <typename T>
+std::enable_if_t<!std::is_integral<T>::value>
+resetBits(T& field)
+{
+ field.reset();
+}
+
/// Return the `index`th bit in `field`
template <typename T>
bool