Lines Matching refs:bitmax

43 zx_status_t RleBitmap::Find(bool is_set, size_t bitoff, size_t bitmax, size_t run_len, size_t* out)
45 *out = bitmax;
50 // Therefore, we can check whether |run_len| bits between |bitmax| and |bitoff| exist before
55 } else if (bitmax - bitoff < run_len) {
60 size_t elem_max = fbl::min(bitmax, elem.end()); // Maximum valid bit within elem.
64 // which are between |bitoff| and |bitmax|.
75 if (bitmax < elem.end()) {
86 if (!is_set && bitmax - bitoff >= run_len) {
97 bool RleBitmap::Get(size_t bitoff, size_t bitmax, size_t* first_unset) const {
107 if (bitoff > bitmax) {
108 bitoff = bitmax;
114 return bitoff == bitmax;
123 zx_status_t RleBitmap::Set(size_t bitoff, size_t bitmax) {
124 return SetInternal(bitoff, bitmax, nullptr);
127 zx_status_t RleBitmap::SetNoAlloc(size_t bitoff, size_t bitmax, FreeList* free_list) {
132 return SetInternal(bitoff, bitmax, free_list);
135 zx_status_t RleBitmap::Clear(size_t bitoff, size_t bitmax) {
136 return ClearInternal(bitoff, bitmax, nullptr);
139 zx_status_t RleBitmap::ClearNoAlloc(size_t bitoff, size_t bitmax, FreeList* free_list) {
144 return ClearInternal(bitoff, bitmax, free_list);
147 zx_status_t RleBitmap::SetInternal(size_t bitoff, size_t bitmax, FreeList* free_list) {
148 if (bitmax < bitoff) {
152 const size_t bitlen = bitmax - bitoff;
210 zx_status_t RleBitmap::ClearInternal(size_t bitoff, size_t bitmax, FreeList* free_list) {
211 if (bitmax < bitoff) {
215 if (bitmax - bitoff == 0) {
225 if (bitmax < itr->bitoff) {
229 if (itr->bitoff + itr->bitlen <= bitmax) {
236 // '*itr' contains [bitoff, bitmax), and we need to split it.
242 new_elem->bitoff = bitmax;
243 new_elem->bitlen = itr->bitoff + itr->bitlen - bitmax;
247 num_bits_ -= (bitmax - bitoff);
251 if (bitmax < itr->bitoff + itr->bitlen) {
252 // 'elem' contains 'bitmax'
253 num_bits_ -= (bitmax - itr->bitoff);
254 itr->bitlen = itr->bitoff + itr->bitlen - bitmax;
255 itr->bitoff = bitmax;
258 // [bitoff, bitmax) fully contains '*itr'.