File tree 10 files changed +17
-63
lines changed
crates/std_detect/src/detect
10 files changed +17
-63
lines changed Original file line number Diff line number Diff line change @@ -90,4 +90,9 @@ cfg_if! {
90
90
mod os;
91
91
}
92
92
}
93
- pub use self :: os:: check_for;
93
+
94
+ /// Performs run-time feature detection.
95
+ #[ inline]
96
+ pub fn check_for ( x : Feature ) -> bool {
97
+ cache:: test ( x as u32 , self :: os:: detect_features)
98
+ }
Original file line number Diff line number Diff line change 1
1
//! Run-time feature detection for Aarch64 on FreeBSD.
2
2
3
- use crate :: detect:: { Feature , cache} ;
4
- use super :: super :: aarch64:: detect_features;
5
-
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
3
+ pub use super :: super :: aarch64:: detect_features;
11
4
12
5
#[ cfg( test) ]
13
6
mod tests {
Original file line number Diff line number Diff line change 3
3
use crate :: detect:: { Feature , cache} ;
4
4
use super :: { auxvec} ;
5
5
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
11
-
12
6
/// Try to read the features from the auxiliary vector
13
- fn detect_features ( ) -> cache:: Initializer {
7
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
14
8
let mut value = cache:: Initializer :: default ( ) ;
15
9
let enable_feature = |value : & mut cache:: Initializer , f, enable| {
16
10
if enable {
Original file line number Diff line number Diff line change 3
3
use crate :: detect:: { Feature , cache} ;
4
4
use super :: { auxvec} ;
5
5
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
11
-
12
- fn detect_features ( ) -> cache:: Initializer {
6
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
13
7
let mut value = cache:: Initializer :: default ( ) ;
14
8
let enable_feature = |value : & mut cache:: Initializer , f, enable| {
15
9
if enable {
Original file line number Diff line number Diff line change 3
3
use crate :: detect:: { Feature , cache, bit} ;
4
4
use super :: { auxvec, cpuinfo} ;
5
5
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
11
-
12
6
/// Try to read the features from the auxiliary vector, and if that fails, try
13
7
/// to read them from /proc/cpuinfo.
14
- fn detect_features ( ) -> cache:: Initializer {
8
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
15
9
if let Ok ( auxv) = auxvec:: auxv ( ) {
16
10
let hwcap: AtHwcap = auxv. into ( ) ;
17
11
return hwcap. cache ( ) ;
Original file line number Diff line number Diff line change 3
3
use crate :: detect:: { Feature , cache, bit} ;
4
4
use super :: { auxvec, cpuinfo} ;
5
5
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
11
-
12
6
/// Try to read the features from the auxiliary vector, and if that fails, try
13
7
/// to read them from /proc/cpuinfo.
14
- fn detect_features ( ) -> cache:: Initializer {
8
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
15
9
let mut value = cache:: Initializer :: default ( ) ;
16
10
let enable_feature = |value : & mut cache:: Initializer , f, enable| {
17
11
if enable {
Original file line number Diff line number Diff line change 3
3
use crate :: detect:: { Feature , cache, bit} ;
4
4
use super :: auxvec;
5
5
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
11
-
12
6
/// Try to read the features from the auxiliary vector, and if that fails, try
13
7
/// to read them from `/proc/cpuinfo`.
14
- fn detect_features ( ) -> cache:: Initializer {
8
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
15
9
let mut value = cache:: Initializer :: default ( ) ;
16
10
let enable_feature = |value : & mut cache:: Initializer , f, enable| {
17
11
if enable {
Original file line number Diff line number Diff line change 3
3
use crate :: detect:: { Feature , cache} ;
4
4
use super :: { auxvec, cpuinfo} ;
5
5
6
- /// Performs run-time feature detection.
7
- #[ inline]
8
- pub fn check_for ( x : Feature ) -> bool {
9
- cache:: test ( x as u32 , detect_features)
10
- }
11
-
12
6
/// Try to read the features from the auxiliary vector, and if that fails, try
13
7
/// to read them from /proc/cpuinfo.
14
- fn detect_features ( ) -> cache:: Initializer {
8
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
15
9
let mut value = cache:: Initializer :: default ( ) ;
16
10
let enable_feature = |value : & mut cache:: Initializer , f, enable| {
17
11
if enable {
Original file line number Diff line number Diff line change 1
1
//! Other operating systems
2
2
3
- use crate :: detect:: Feature ;
3
+ use crate :: detect:: cache ;
4
4
5
- /// Performs run-time feature detection.
6
- #[ inline]
7
- pub fn check_for ( _x : Feature ) -> bool {
8
- false
5
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
6
+ cache:: Initializer :: default ( )
9
7
}
Original file line number Diff line number Diff line change @@ -9,12 +9,6 @@ use crate::mem;
9
9
10
10
use crate :: detect:: { Feature , cache, bit} ;
11
11
12
- /// Performs run-time feature detection.
13
- #[ inline]
14
- pub fn check_for ( x : Feature ) -> bool {
15
- cache:: test ( x as u32 , detect_features)
16
- }
17
-
18
12
/// Run-time feature detection on x86 works by using the CPUID instruction.
19
13
///
20
14
/// The [CPUID Wikipedia page][wiki_cpuid] contains
@@ -31,7 +25,7 @@ pub fn check_for(x: Feature) -> bool {
31
25
/// [intel64_ref]: http://www.intel.de/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
32
26
/// [amd64_ref]: http://support.amd.com/TechDocs/24594.pdf
33
27
#[ allow( clippy:: similar_names) ]
34
- fn detect_features ( ) -> cache:: Initializer {
28
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
35
29
let mut value = cache:: Initializer :: default ( ) ;
36
30
37
31
// If the x86 CPU does not support the CPUID instruction then it is too
You can’t perform that action at this time.
0 commit comments