Skip to content

Commit 52c96c3

Browse files
authored
cpubits: better ARMv7 cfg predicate (#1431)
We can use the explicit: all(target_arch = "arm", target_feature = "v7") Rather than the previous check for targets that are not thumb: all(target_arch = "arm", not(target_feature = "thumb-mode"))
1 parent 0c64901 commit 52c96c3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

cpubits/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
/// certain targets from 32-bit to 64-bit ones.
101101
///
102102
/// This 64-bit promotion occurs if `any` of the following `cfg`s are true:
103-
/// - ARMv7: `all(target_arch = "arm", not(target_feature = "thumb-mode"))`
103+
/// - ARMv7: `all(target_arch = "arm", target_feature = "v7")`
104104
/// - WASM: `target_arch = "wasm32"`
105105
#[macro_export]
106106
macro_rules! cpubits {
@@ -184,7 +184,7 @@ macro_rules! cpubits {
184184
// `cfg` selector for 64-bit target overrides
185185
#[cfg(enable_64_bit = any(
186186
// ARMv7
187-
all(target_arch = "arm", not(target_feature = "thumb-mode")),
187+
all(target_arch = "arm", target_feature = "v7"),
188188
// WASM
189189
target_arch = "wasm32",
190190
))]
@@ -321,7 +321,7 @@ mod tests {
321321
// Duplicated 64-bit override predicates need to go here
322322
if cfg!(any(
323323
// ARMv7
324-
all(target_arch = "arm", not(target_feature = "thumb-mode")),
324+
all(target_arch = "arm", target_feature = "v7"),
325325
// WASM
326326
target_arch = "wasm32"
327327
)) {
@@ -337,7 +337,7 @@ mod tests {
337337
}
338338

339339
/// Explicit test for ARMv7 so we can see the predicate is working
340-
#[cfg(all(target_arch = "arm", not(target_feature = "thumb-mode")))]
340+
#[cfg(all(target_arch = "arm", target_feature = "v7"))]
341341
#[test]
342342
fn cpubits_on_armv7_is_64bit() {
343343
assert_eq!(CPUBITS, 64);

0 commit comments

Comments
 (0)