Core/Bitset: Add Read method and FromPointer static method
This commit is contained in:
@@ -24,6 +24,7 @@ namespace Nz
|
||||
|
||||
public:
|
||||
class Bit;
|
||||
using PointerSequence = std::pair<const void*, std::size_t>; //< Start pointer, bit offset
|
||||
|
||||
Bitset();
|
||||
explicit Bitset(std::size_t bitCount, bool val);
|
||||
@@ -49,6 +50,9 @@ namespace Nz
|
||||
std::size_t GetCapacity() const;
|
||||
std::size_t GetSize() const;
|
||||
|
||||
PointerSequence Read(const void* ptr, std::size_t bitCount);
|
||||
PointerSequence Read(const PointerSequence& sequence, std::size_t bitCount);
|
||||
|
||||
void PerformsAND(const Bitset& a, const Bitset& b);
|
||||
void PerformsNOT(const Bitset& a);
|
||||
void PerformsOR(const Bitset& a, const Bitset& b);
|
||||
@@ -107,6 +111,8 @@ namespace Nz
|
||||
static constexpr std::size_t bitsPerBlock = std::numeric_limits<Block>::digits;
|
||||
static constexpr std::size_t npos = std::numeric_limits<std::size_t>::max();
|
||||
|
||||
static Bitset FromPointer(const void* ptr, std::size_t bitCount, PointerSequence* sequence = nullptr);
|
||||
|
||||
private:
|
||||
std::size_t FindFirstFrom(std::size_t blockIndex) const;
|
||||
Block GetLastBlockMask() const;
|
||||
|
||||
Reference in New Issue
Block a user