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
/// Calculates the CRC32 value of a byte array.
///
/// This function takes in a register value and a byte array, and calculates
/// the CRC32 value of the array by iterating over it and updating the register
/// value using the current byte and the current register value. The specific
/// polynomial used for the calculation is 0xedb88320, which is a common value
/// used in the CRC32 algorithm.
///
/// At the end, the function returns the final register value as the CRC32 value.
///
/// # Arguments
///
/// * `reg` - The initial register value for the CRC32 calculation.
/// * `s` - A slice of bytes representing the input data for which to calculate the CRC32 value.
///
/// # Returns
///
/// * The CRC32 value of the input data as a `u32`.