Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
awxkee committed Jun 15, 2024
1 parent 345e994 commit 336a94e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/rgb_expand.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#[cfg(all(
any(target_arch = "x86_64", target_arch = "x86"),
target_feature = "avx2"
))]
use crate::avx::*;
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#[cfg(all(
any(target_arch = "x86_64", target_arch = "x86"),
target_feature = "sse4.1"
))]
use crate::sse::*;
#[cfg(all(
any(target_arch = "aarch64", target_arch = "arm"),
Expand All @@ -25,7 +31,10 @@ pub fn rgb_to_rgba(
let mut dst_offset = 0usize;
let mut src_offset = 0usize;

#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#[cfg(all(
any(target_arch = "x86_64", target_arch = "x86"),
target_feature = "sse4.1"
))]
let mut _use_sse = false;

#[cfg(all(
Expand Down
6 changes: 5 additions & 1 deletion src/sse/sse_support.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
use crate::avx::shuffle;
#[cfg(target_arch = "x86")]
use std::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use std::arch::x86_64::*;

pub const fn shuffle(z: u32, y: u32, x: u32, w: u32) -> i32 {
// Checked: we want to reinterpret the bits
((z << 6) | (y << 4) | (x << 2) | w) as i32
}

#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
#[inline(always)]
#[allow(dead_code)]
Expand Down

0 comments on commit 336a94e

Please sign in to comment.