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

Function leading_zeros_u64

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

Source from the content-addressed store, hash-verified

224#[must_use]
225#[allow(clippy::cast_possible_truncation)]
226pub const fn leading_zeros_u64(value: u64) -> u32 {
227 #[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))]
228 {
229 value.leading_zeros()
230 }
231 #[cfg(not(any(target_arch = "aarch64", target_arch = "x86_64")))]
232 {
233 let hi = (value >> 32) as u32;
234 let lo = value as u32;
235 let mask = Choice::from_u32_nz(hi).not().to_u32_mask();
236 leading_zeros_u32(hi).wrapping_add(mask & leading_zeros_u32(lo))
237 }
238}
239
240/// Count trailing zero bits, returning 64 if `value` is zero.
241#[inline]

Callers

nothing calls this directly

Calls 4

from_u32_nzFunction · 0.85
leading_zeros_u32Function · 0.85
to_u32_maskMethod · 0.80
notMethod · 0.80

Tested by

no test coverage detected