#ifndef BITMASK_H
#define BITMASK_H
#include <cstddef>
#include <cstdint>
#include <vector>
namespace sperr {
class Bitmask {
public:
Bitmask(size_t nbits = 0);
auto size() const -> size_t; void resize(size_t nbits);
auto rlong(size_t idx) const -> uint64_t; auto rbit(size_t idx) const -> bool;
auto has_true(size_t start, size_t len) const -> bool;
auto find_true(size_t start, size_t len) const -> int64_t;
auto count_true() const -> size_t;
void wbit(size_t idx, bool bit);
void wlong(size_t idx, uint64_t value); void wtrue(size_t idx); void wfalse(size_t idx); void reset(); void reset_true();
auto view_buffer() const -> const std::vector<uint64_t>&;
void use_bitstream(const void* p);
#if __cplusplus >= 202002L && defined __cpp_lib_three_way_comparison
auto operator<=>(const Bitmask& rhs) const noexcept;
auto operator==(const Bitmask& rhs) const noexcept -> bool;
#endif
private:
size_t m_num_bits = 0;
std::vector<uint64_t> m_buf;
};
};
#endif