#include <SkBitSet.h>
Definition at line 21 of file SkBitSet.h.
◆ OptionalIndex
◆ SkBitSet() [1/3]
SkBitSet::SkBitSet |
( |
size_t |
size | ) |
|
|
inlineexplicit |
Definition at line 23 of file SkBitSet.h.
25 , fChunks((Chunk*)
sk_calloc_throw(NumChunksFor(fSize) *
sizeof(Chunk))) {}
static void * sk_calloc_throw(size_t size)
◆ SkBitSet() [2/3]
◆ SkBitSet() [3/3]
Definition at line 29 of file SkBitSet.h.
29{ *this = std::move(that); }
◆ ~SkBitSet()
◆ findFirst()
Definition at line 95 of file SkBitSet.h.
95 {
96 const Chunk* chunks = fChunks.get();
97 const size_t numChunks = NumChunksFor(fSize);
98 for (
size_t i = 0;
i < numChunks; ++
i) {
99 if (Chunk chunk = chunks[
i]) {
100 static_assert(kChunkBits <= std::numeric_limits<uint32_t>::digits, "SkCTZ");
101 const size_t bitIndex =
i * kChunkBits +
SkCTZ(chunk);
103 }
104 }
106 }
static int SkCTZ(uint32_t mask)
std::optional< size_t > OptionalIndex
◆ findFirstUnset()
Definition at line 109 of file SkBitSet.h.
109 {
110 const Chunk* chunks = fChunks.get();
111 const size_t numChunks = NumChunksFor(fSize);
112 for (
size_t i = 0;
i < numChunks; ++
i) {
113 if (Chunk chunk = ~chunks[
i]) {
114 static_assert(kChunkBits <= std::numeric_limits<uint32_t>::digits, "SkCTZ");
115 const size_t bitIndex =
i * kChunkBits +
SkCTZ(chunk);
116 if (bitIndex >= fSize) {
117 break;
118 }
120 }
121 }
123 }
◆ forEachSetIndex()
template<typename FN >
void SkBitSet::forEachSetIndex |
( |
FN |
f | ) |
const |
|
inline |
Definition at line 77 of file SkBitSet.h.
77 {
78 const Chunk* chunks = fChunks.get();
79 const size_t numChunks = NumChunksFor(fSize);
80 for (
size_t i = 0;
i < numChunks; ++
i) {
81 if (Chunk chunk = chunks[
i]) {
82 const size_t index =
i * kChunkBits;
83 for (size_t j = 0; j < kChunkBits; ++j) {
84 if (0x1 & (chunk >> j)) {
86 }
87 }
88 }
89 }
90 }
◆ operator=() [1/2]
◆ operator=() [2/2]
Definition at line 30 of file SkBitSet.h.
30 {
31 if (this != &that) {
32 this->fSize = that.fSize;
33 this->fChunks = std::move(that.fChunks);
34 that.fSize = 0;
35 }
36 return *this;
37 }
◆ reset() [1/2]
Sets every bit in the bitset to false.
Definition at line 60 of file SkBitSet.h.
60 {
61 Chunk* chunks = fChunks.get();
62 const size_t numChunks = NumChunksFor(fSize);
63 std::memset(chunks, 0, sizeof(Chunk) * numChunks);
64 }
◆ reset() [2/2]
void SkBitSet::reset |
( |
size_t |
index | ) |
|
|
inline |
Set the value of the index-th bit to false.
Definition at line 54 of file SkBitSet.h.
54 {
56 *this->chunkFor(index) &= ~ChunkMaskFor(index);
57 }
◆ set() [1/2]
Sets every bit in the bitset to true.
Definition at line 47 of file SkBitSet.h.
47 {
48 Chunk* chunks = fChunks.get();
49 const size_t numChunks = NumChunksFor(fSize);
50 std::memset(chunks, 0xFF, sizeof(Chunk) * numChunks);
51 }
◆ set() [2/2]
void SkBitSet::set |
( |
size_t |
index | ) |
|
|
inline |
Set the value of the index-th bit to true.
Definition at line 41 of file SkBitSet.h.
41 {
43 *this->chunkFor(index) |= ChunkMaskFor(index);
44 }
◆ size()
size_t SkBitSet::size |
( |
| ) |
const |
|
inline |
Definition at line 71 of file SkBitSet.h.
71 {
72 return fSize;
73 }
◆ test()
bool SkBitSet::test |
( |
size_t |
index | ) |
const |
|
inline |
Definition at line 66 of file SkBitSet.h.
66 {
68 return SkToBool(*this->chunkFor(index) & ChunkMaskFor(index));
69 }
static constexpr bool SkToBool(const T &x)
The documentation for this class was generated from the following file: