Dedupe function
This commit is contained in:
parent
9a0f0e4e57
commit
66c533636a
1 changed files with 5 additions and 9 deletions
|
|
@ -15,21 +15,17 @@ pub fn inflate(data: &[u8]) -> PngResult<Vec<u8>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compress a data stream using the DEFLATE algorithm
|
/// Compress a data stream using the DEFLATE algorithm
|
||||||
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
|
||||||
pub fn deflate(data: &[u8], zc: u8, zs: u8, zw: u8, max_size: &AtomicMin) -> PngResult<Vec<u8>> {
|
pub fn deflate(data: &[u8], zc: u8, zs: u8, zw: u8, max_size: &AtomicMin) -> PngResult<Vec<u8>> {
|
||||||
if is_cfzlib_supported() {
|
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
||||||
return cfzlib_deflate(data, zc, zs, zw, max_size);
|
{
|
||||||
|
if is_cfzlib_supported() {
|
||||||
|
return cfzlib_deflate(data, zc, zs, zw, max_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
miniz_stream::compress_to_vec_oxipng(data, zc, zw.into(), zs.into(), max_size)
|
miniz_stream::compress_to_vec_oxipng(data, zc, zw.into(), zs.into(), max_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compress a data stream using the DEFLATE algorithm
|
|
||||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
|
|
||||||
pub fn deflate(data: &[u8], zc: u8, zs: u8, zw: u8, max_size: &AtomicMin) -> PngResult<Vec<u8>> {
|
|
||||||
miniz_stream::compress_to_vec_oxipng(data, zc, zw.into(), zs.into(), max_size)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
fn is_cfzlib_supported() -> bool {
|
fn is_cfzlib_supported() -> bool {
|
||||||
if is_x86_feature_detected!("sse4.2") && is_x86_feature_detected!("pclmulqdq") {
|
if is_x86_feature_detected!("sse4.2") && is_x86_feature_detected!("pclmulqdq") {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue