Skip to content

Commit 0968b02

Browse files
committed
Improve function reuse
1 parent 86a99cd commit 0968b02

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/arch/mod.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,7 @@ pub(crate) unsafe fn update(state: u64, bytes: &[u8], params: CrcParams) -> u64
8888
}
8989

9090
// fallback to the standard x86 SSE implementation
91-
92-
let ops = X86Ops;
93-
94-
match params.width {
95-
64 => algorithm::update::<X86Ops, Width64>(state, bytes, params, &ops),
96-
32 => algorithm::update::<X86Ops, Width32>(state as u32, bytes, params, &ops) as u64,
97-
_ => panic!("Unsupported CRC width: {}", params.width),
98-
}
91+
update_x86_sse(state, bytes, params)
9992
}
10093

10194
#[inline]
@@ -109,7 +102,7 @@ pub(crate) unsafe fn update(state: u64, bytes: &[u8], params: CrcParams) -> u64
109102
}
110103

111104
#[inline]
112-
#[cfg(target_arch = "x86")]
105+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
113106
#[target_feature(enable = "sse2,sse4.1,pclmulqdq")]
114107
unsafe fn update_x86_sse(state: u64, bytes: &[u8], params: CrcParams) -> u64 {
115108
let ops = X86Ops;

0 commit comments

Comments
 (0)