Lines Matching full:bytes
18 * Returns: size in bytes of the encoded integer - at most 9 bytes
23 unsigned bytes = DIV_ROUND_UP(bits, 7); in bch2_varint_encode() local
26 if (likely(bytes < 9)) { in bch2_varint_encode()
27 v <<= bytes; in bch2_varint_encode()
28 v |= ~(~0 << (bytes - 1)); in bch2_varint_encode()
30 memcpy(out, &v_le, bytes); in bch2_varint_encode()
33 bytes = 9; in bch2_varint_encode()
37 return bytes; in bch2_varint_encode()
45 * Returns: size in bytes of the decoded integer - or -1 on failure (would
50 unsigned bytes = likely(in < end) in bch2_varint_decode() local
55 if (unlikely(in + bytes > end)) in bch2_varint_decode()
58 if (likely(bytes < 9)) { in bch2_varint_decode()
61 memcpy(&v_le, in, bytes); in bch2_varint_decode()
63 v >>= bytes; in bch2_varint_decode()
69 return bytes; in bch2_varint_decode()
76 * Returns: size in bytes of the encoded integer - at most 9 bytes
78 * This version assumes it's always safe to write 8 bytes to @out, even if the
84 unsigned bytes = DIV_ROUND_UP(bits, 7); in bch2_varint_encode_fast() local
86 if (likely(bytes < 9)) { in bch2_varint_encode_fast()
87 v <<= bytes; in bch2_varint_encode_fast()
88 v |= ~(~0U << (bytes - 1)); in bch2_varint_encode_fast()
91 bytes = 9; in bch2_varint_encode_fast()
95 return bytes; in bch2_varint_encode_fast()
103 * Returns: size in bytes of the decoded integer - or -1 on failure (would
106 * This version assumes that it is safe to read at most 8 bytes past the end of
115 unsigned bytes = ffz(*in) + 1; in bch2_varint_decode_fast() local
117 if (unlikely(in + bytes > end)) in bch2_varint_decode_fast()
120 if (likely(bytes < 9)) { in bch2_varint_decode_fast()
121 v >>= bytes; in bch2_varint_decode_fast()
122 v &= ~(~0ULL << (7 * bytes)); in bch2_varint_decode_fast()
128 return bytes; in bch2_varint_decode_fast()