From 8e69c9c459600901b998faee80edf654819e2b5b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 8 Aug 2021 14:16:31 +0100 Subject: Simplify some bits with concepts --- lib/helpers.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/helpers.h') diff --git a/lib/helpers.h b/lib/helpers.h index 5bf1bd8..f09a206 100644 --- a/lib/helpers.h +++ b/lib/helpers.h @@ -8,9 +8,8 @@ #include namespace MyGrate { - template constexpr inline auto - bitslice(const I i, uint8_t offset, uint8_t size) + bitslice(const std::integral auto i, uint8_t offset, uint8_t size) { return (i >> offset) & ((1U << size) - 1U); } @@ -25,9 +24,8 @@ namespace MyGrate { return expr; } - template constexpr inline auto - mod100_extract(T & i) + mod100_extract(std::integral auto & i) { const auto r {i % 100}; i /= 100; @@ -41,6 +39,7 @@ namespace MyGrate { std::to_string(a) } -> std::same_as; }; + template concept Viewable = requires(T a) { -- cgit v1.2.3