Lines Matching full:bytes

19  * Returns:	size in bytes of the encoded integer - at most 9 bytes
24 unsigned bytes = DIV_ROUND_UP(bits, 7); in bch2_varint_encode() local
27 if (likely(bytes < 9)) { in bch2_varint_encode()
28 v <<= bytes; in bch2_varint_encode()
29 v |= ~(~0 << (bytes - 1)); in bch2_varint_encode()
31 memcpy(out, &v_le, bytes); in bch2_varint_encode()
34 bytes = 9; in bch2_varint_encode()
38 return bytes; in bch2_varint_encode()
46 * Returns: size in bytes of the decoded integer - or -1 on failure (would
51 unsigned bytes = likely(in < end) in bch2_varint_decode() local
56 if (unlikely(in + bytes > end)) in bch2_varint_decode()
59 if (likely(bytes < 9)) { in bch2_varint_decode()
62 memcpy(&v_le, in, bytes); in bch2_varint_decode()
64 v >>= bytes; in bch2_varint_decode()
70 return bytes; in bch2_varint_decode()
77 * Returns: size in bytes of the encoded integer - at most 9 bytes
79 * This version assumes it's always safe to write 8 bytes to @out, even if the
85 unsigned bytes = DIV_ROUND_UP(bits, 7); in bch2_varint_encode_fast() local
87 if (likely(bytes < 9)) { in bch2_varint_encode_fast()
88 v <<= bytes; in bch2_varint_encode_fast()
89 v |= ~(~0U << (bytes - 1)); in bch2_varint_encode_fast()
92 bytes = 9; in bch2_varint_encode_fast()
96 return bytes; in bch2_varint_encode_fast()
104 * Returns: size in bytes of the decoded integer - or -1 on failure (would
107 * This version assumes that it is safe to read at most 8 bytes past the end of
116 unsigned bytes = ffz(*in) + 1; in bch2_varint_decode_fast() local
118 if (unlikely(in + bytes > end)) in bch2_varint_decode_fast()
121 if (likely(bytes < 9)) { in bch2_varint_decode_fast()
122 v >>= bytes; in bch2_varint_decode_fast()
123 v &= ~(~0ULL << (7 * bytes)); in bch2_varint_decode_fast()
129 return bytes; in bch2_varint_decode_fast()