1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use Vec;
/// Returns the minimum number of bytes needed to represent this value, as
/// either 1, 2, 4, or 8 bytes. A value of 0 will still return one byte.
///
/// Used for variable length fields like `Dictionary_ID`.
/// Appends the value represented using the smallest number of bytes needed
/// (1, 2, 4, or 8; zero takes 1 byte) directly onto `output`.
///
/// Operates in **little-endian**.
/// Returns the minimum FCS field size for the given content size.
///
/// FCS has different sizing rules than `Dictionary_ID` due to the +256 offset
/// for 2-byte fields (spec range 256–65791). When `single_segment` is true,
/// values 0–255 can use a 1-byte field (FCS flag = 0 combined with the
/// single-segment flag). Otherwise, only the 1-byte encoding is unavailable:
/// values 256–65791 still use a 2-byte field, while smaller values fall back
/// to the 4-byte encoding.
///
/// <https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frame_content_size>