summaryrefslogtreecommitdiffstats
path: root/vendor/miniz_oxide/src/shared.rs
blob: 8b81fb112b8c0bc950ba0d008ad78717bb530ca0 (plain)
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
#[doc(hidden)]
pub const MZ_ADLER32_INIT: u32 = 1;

#[doc(hidden)]
pub const MZ_DEFAULT_WINDOW_BITS: i32 = 15;

pub const HUFFMAN_LENGTH_ORDER: [u8; 19] = [
    16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15,
];

#[doc(hidden)]
#[cfg(not(feature = "simd"))]
pub fn update_adler32(adler: u32, data: &[u8]) -> u32 {
    let mut hash = adler::Adler32::from_checksum(adler);
    hash.write_slice(data);
    hash.checksum()
}

#[doc(hidden)]
#[cfg(feature = "simd")]
pub fn update_adler32(adler: u32, data: &[u8]) -> u32 {
    let mut hash = simd_adler32::Adler32::from_checksum(adler);
    hash.write(data);
    hash.finish()
}