Skip to content

Commit 83a8e91

Browse files
committed
Delete no_nonzero_bitscan configuration
1 parent e606a17 commit 83a8e91

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

build.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@ fn main() {
1111
};
1212

1313
if compiler >= 80 {
14-
println!("cargo:rustc-check-cfg=cfg(no_nonzero_bitscan)");
1514
println!("cargo:rustc-check-cfg=cfg(test_node_semver)");
1615
}
17-
18-
if compiler < 53 {
19-
// Efficient intrinsics for count-leading-zeros and count-trailing-zeros
20-
// on NonZero integers stabilized in 1.53.0. On many architectures these
21-
// are more efficient than counting zeros on ordinary zeroable integers.
22-
// https://doc.rust-lang.org/std/num/struct.NonZeroU64.html#method.leading_zeros
23-
// https://doc.rust-lang.org/std/num/struct.NonZeroU64.html#method.trailing_zeros
24-
println!("cargo:rustc-cfg=no_nonzero_bitscan");
25-
}
2616
}
2717

2818
fn rustc_minor_version() -> Option<u32> {

src/identifier.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,6 @@ unsafe fn inline_len(repr: &Identifier) -> NonZeroUsize {
320320
// because inline strings are at least 1 byte long and cannot contain \0.
321321
let repr = unsafe { ptr::read(repr as *const Identifier as *const NonZeroU64) };
322322

323-
// Rustc >=1.53 has intrinsics for counting zeros on a non-zeroable integer.
324-
// On many architectures these are more efficient than counting on ordinary
325-
// zeroable integers (bsf vs cttz). On rustc <1.53 without those intrinsics,
326-
// we count zeros in the u64 rather than the NonZeroU64.
327-
#[cfg(no_nonzero_bitscan)]
328-
let repr = repr.get();
329-
330323
#[cfg(target_endian = "little")]
331324
let zero_bits_on_string_end = repr.leading_zeros();
332325
#[cfg(target_endian = "big")]
@@ -413,9 +406,6 @@ unsafe fn ptr_as_str(repr: &NonNull<u8>) -> &str {
413406

414407
// Number of base-128 digits required for the varint representation of a length.
415408
fn bytes_for_varint(len: NonZeroUsize) -> usize {
416-
#[cfg(no_nonzero_bitscan)] // rustc <1.53
417-
let len = len.get();
418-
419409
let usize_bits = mem::size_of::<usize>() * 8;
420410
let len_bits = usize_bits - len.leading_zeros() as usize;
421411
(len_bits + 6) / 7

0 commit comments

Comments
 (0)