aboutsummaryrefslogtreecommitdiffstats
path: root/common/albyte.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/albyte.h')
-rw-r--r--common/albyte.h47
1 files changed, 0 insertions, 47 deletions
diff --git a/common/albyte.h b/common/albyte.h
index 29a0790f..b871164d 100644
--- a/common/albyte.h
+++ b/common/albyte.h
@@ -62,53 +62,6 @@ AL_DECL_OP(^, ^=)
constexpr al::byte operator~(al::byte b) noexcept
{ return al::byte(~to_integer<uint>(b)); }
-
-namespace detail_ {
- template<size_t> struct Elem { };
- template<> struct Elem<1> { using type = uint8_t; };
- template<> struct Elem<2> { using type = uint16_t; };
- template<> struct Elem<3> { using type = uint32_t; };
- template<> struct Elem<4> { using type = uint32_t; };
-
- template<size_t N> using ElemT = typename Elem<N>::type;
-} // namespace detail_
-
-template<size_t N>
-class bitfield {
- static constexpr size_t bits_per_byte{std::numeric_limits<unsigned char>::digits};
- static constexpr size_t NumElems{(N+bits_per_byte-1) / bits_per_byte};
-
- using storage_type = detail_::ElemT<NumElems>;
- storage_type vals{};
-
-public:
- template<size_t b>
- inline void set() noexcept
- {
- static_assert(b < N, "Bit index out of range");
- vals |= 1 << b;
- }
- template<size_t b>
- inline void unset() noexcept
- {
- static_assert(b < N, "Bit index out of range");
- vals &= static_cast<storage_type>(~(1 << b));
- }
- template<size_t b>
- inline bool get() const noexcept
- {
- static_assert(b < N, "Bit index out of range");
- return (vals & (1 << b)) != 0;
- }
-
- template<size_t b, size_t ...args>
- std::enable_if_t<(sizeof...(args) > 0)> set() noexcept
- {
- set<b>();
- set<args...>();
- }
-};
-
} // namespace al
#endif /* AL_BYTE_H */