MCPcopy Create free account
hub / github.com/RustCrypto/utils / trailing_zeros_u64

Function trailing_zeros_u64

ctutils/src/primitives.rs:244–256  ·  view source on GitHub ↗
(value: u64)

Source from the content-addressed store, hash-verified

242#[must_use]
243#[allow(clippy::cast_possible_truncation)]
244pub const fn trailing_zeros_u64(value: u64) -> u32 {
245 #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
246 {
247 value.trailing_zeros()
248 }
249 #[cfg(not(any(target_arch = "aarch64", target_arch = "x86_64")))]
250 {
251 let hi = (value >> 32) as u32;
252 let lo = value as u32;
253 let mask = Choice::from_u32_nz(lo).not().to_u32_mask();
254 trailing_zeros_u32(lo).wrapping_add(mask & trailing_zeros_u32(hi))
255 }
256}
257
258/// Fixed-stage binary search for the highest set bit, including the zero case.
259#[cfg(any(

Callers

nothing calls this directly

Calls 4

from_u32_nzFunction · 0.85
trailing_zeros_u32Function · 0.85
to_u32_maskMethod · 0.80
notMethod · 0.80

Tested by

no test coverage detected