Lines Matching refs:bits
106 unsigned bits; /* bits remaining in current word */ member
119 .bits = 64 - high_bit_offset, in pack_state_init()
137 unsigned bits; /* bits remaining in current word */ member
150 .bits = 64 - high_bit_offset, in unpack_state_init()
159 unsigned bits = state->format->bits_per_field[field]; in get_inc_field() local
162 if (bits >= state->bits) { in get_inc_field()
163 v = state->w >> (64 - bits); in get_inc_field()
164 bits -= state->bits; in get_inc_field()
168 state->bits = 64; in get_inc_field()
172 v |= (state->w >> 1) >> (63 - bits); in get_inc_field()
173 state->w <<= bits; in get_inc_field()
174 state->bits -= bits; in get_inc_field()
182 unsigned bits = state->format->bits_per_field[field]; in __set_inc_field() local
184 if (bits) { in __set_inc_field()
185 if (bits > state->bits) { in __set_inc_field()
186 bits -= state->bits; in __set_inc_field()
188 state->w |= (v >> 1) >> (bits - 1); in __set_inc_field()
193 state->bits = 64; in __set_inc_field()
196 state->bits -= bits; in __set_inc_field()
197 state->w |= v << state->bits; in __set_inc_field()
204 unsigned bits = state->format->bits_per_field[field]; in set_inc_field() local
212 if (fls64(v) > bits) in set_inc_field()
385 unsigned bits = state->format->bits_per_field[field]; in set_inc_field_lossy() local
392 if (fls64(v) > bits) { in set_inc_field_lossy()
393 v = ~(~0ULL << bits); in set_inc_field_lossy()
422 unsigned bits = min(64 - offset, nr_key_bits); in bkey_packed_successor() local
423 u64 mask = (~0ULL >> (64 - bits)) << offset; in bkey_packed_successor()
433 nr_key_bits -= bits; in bkey_packed_successor()
571 unsigned bits, u64 offset) in set_format_field() argument
576 bits = min(bits, unpacked_bits); in set_format_field()
578 offset = bits == unpacked_bits ? 0 : min(offset, unpacked_max - ((1ULL << bits) - 1)); in set_format_field()
580 f->bits_per_field[i] = bits; in set_format_field()
586 unsigned i, bits = KEY_PACKED_BITS_START; in bch2_bkey_format_done() local
598 bits += ret.bits_per_field[i]; in bch2_bkey_format_done()
606 bits += b; in bch2_bkey_format_done()
609 ret.key_u64s = DIV_ROUND_UP(bits, 64); in bch2_bkey_format_done()
612 bits = ret.key_u64s * 64 - bits; in bch2_bkey_format_done()
618 if (r <= bits) { in bch2_bkey_format_done()
622 bits -= r; in bch2_bkey_format_done()
641 unsigned bits = KEY_PACKED_BITS_START; in bch2_bkey_format_invalid() local
667 bits += f->bits_per_field[i]; in bch2_bkey_format_invalid()
670 if (f->key_u64s != DIV_ROUND_UP(bits, 64)) { in bch2_bkey_format_invalid()
672 f->key_u64s, DIV_ROUND_UP(bits, 64)); in bch2_bkey_format_invalid()
758 unsigned bits = nr_key_bits + offset < 64 in bch2_bkey_ffs() local
762 u64 mask = (~0ULL >> (64 - bits)) << offset; in bch2_bkey_ffs()
768 nr_key_bits -= bits; in bch2_bkey_ffs()
769 ret += bits; in bch2_bkey_ffs()
790 unsigned bits = format->bits_per_field[field]; in compile_bkey_field() local
794 if (!bits && !offset) { in compile_bkey_field()
804 if (!bits) { in compile_bkey_field()
848 if (bit_offset == 0 && bits == 8) { in compile_bkey_field()
851 } else if (bit_offset == 0 && bits == 16) { in compile_bkey_field()
854 } else if (bit_offset + bits <= 32) { in compile_bkey_field()
855 align = min(4 - DIV_ROUND_UP(bit_offset + bits, 8), byte & 3); in compile_bkey_field()
859 BUG_ON(bit_offset + bits > 32); in compile_bkey_field()
869 if (bit_offset + bits < 32) { in compile_bkey_field()
870 unsigned mask = ~0U >> (32 - bits); in compile_bkey_field()
877 } else if (bit_offset + bits <= 64) { in compile_bkey_field()
878 align = min(8 - DIV_ROUND_UP(bit_offset + bits, 8), byte & 7); in compile_bkey_field()
882 BUG_ON(bit_offset + bits > 64); in compile_bkey_field()
887 shl = 64 - bit_offset - bits; in compile_bkey_field()
900 align = min(4 - DIV_ROUND_UP(bit_offset + bits, 8), byte & 3); in compile_bkey_field()
904 BUG_ON(bit_offset + bits > 96); in compile_bkey_field()
913 shr = bit_offset + bits - 64; in compile_bkey_field()
941 } else if (offset + (~0ULL >> (64 - bits)) > U32_MAX) { in compile_bkey_field()