@@ -54,18 +54,20 @@ pub(crate) unsafe fn update(state: u64, bytes: &[u8], params: CrcParams) -> u64
54
54
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
55
55
#[ target_feature( enable = "sse2,sse4.1,pclmulqdq" ) ]
56
56
pub ( crate ) unsafe fn update ( state : u64 , bytes : & [ u8 ] , params : CrcParams ) -> u64 {
57
- let ops = X86Ops ;
57
+ update_x86_sse ( state, bytes, params)
58
+ }
58
59
59
- match params. width {
60
- 64 => algorithm:: update :: < X86Ops , Width64 > ( state, bytes, params, & ops) ,
61
- 32 => algorithm:: update :: < X86Ops , Width32 > ( state as u32 , bytes, params, & ops) as u64 ,
62
- _ => panic ! ( "Unsupported CRC width: {}" , params. width) ,
63
- }
60
+ #[ rustversion:: since( 1.89 ) ]
61
+ #[ inline]
62
+ #[ cfg( target_arch = "x86" ) ]
63
+ #[ target_feature( enable = "sse2,sse4.1,pclmulqdq" ) ]
64
+ pub ( crate ) unsafe fn update ( state : u64 , bytes : & [ u8 ] , params : CrcParams ) -> u64 {
65
+ update_x86_sse ( state, bytes, params)
64
66
}
65
67
66
68
#[ rustversion:: since( 1.89 ) ]
67
69
#[ inline]
68
- #[ cfg( any ( target_arch = "x86" , target_arch = " x86_64") ) ]
70
+ #[ cfg( target_arch = "x86_64" ) ]
69
71
#[ target_feature( enable = "sse2,sse4.1,pclmulqdq" ) ]
70
72
pub ( crate ) unsafe fn update ( state : u64 , bytes : & [ u8 ] , params : CrcParams ) -> u64 {
71
73
use std:: arch:: is_x86_feature_detected;
@@ -106,6 +108,19 @@ pub(crate) unsafe fn update(state: u64, bytes: &[u8], params: CrcParams) -> u64
106
108
software:: update ( state, bytes, params)
107
109
}
108
110
111
+ #[ inline]
112
+ #[ cfg( target_arch = "x86" ) ]
113
+ #[ target_feature( enable = "sse2,sse4.1,pclmulqdq" ) ]
114
+ unsafe fn update_x86_sse ( state : u64 , bytes : & [ u8 ] , params : CrcParams ) -> u64 {
115
+ let ops = X86Ops ;
116
+
117
+ match params. width {
118
+ 64 => algorithm:: update :: < X86Ops , Width64 > ( state, bytes, params, & ops) ,
119
+ 32 => algorithm:: update :: < X86Ops , Width32 > ( state as u32 , bytes, params, & ops) as u64 ,
120
+ _ => panic ! ( "Unsupported CRC width: {}" , params. width) ,
121
+ }
122
+ }
123
+
109
124
#[ rustversion:: before( 1.89 ) ]
110
125
pub fn get_target ( ) -> String {
111
126
#[ cfg( target_arch = "aarch64" ) ]
0 commit comments