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

Function trailing_zeros_u32

ctutils/src/primitives.rs:198–220  ·  view source on GitHub ↗
(value: u32)

Source from the content-addressed store, hash-verified

196#[inline]
197#[must_use]
198pub const fn trailing_zeros_u32(value: u32) -> u32 {
199 #[cfg(any(
200 target_arch = "aarch64",
201 target_arch = "x86",
202 target_arch = "x86_64",
203 target_feature = "thumb2",
204 target_feature = "zbb"
205 ))]
206 {
207 value.trailing_zeros()
208 }
209 #[cfg(not(any(
210 target_arch = "aarch64",
211 target_arch = "x86",
212 target_arch = "x86_64",
213 target_feature = "thumb2",
214 target_feature = "zbb"
215 )))]
216 {
217 // Reversing bits uses fixed shifts and masks when RBIT is unavailable.
218 leading_zeros_u32_soft(value.reverse_bits())
219 }
220}
221
222/// Count leading zero bits, returning 64 if `value` is zero.
223#[inline]

Callers 1

trailing_zeros_u64Function · 0.85

Calls 1

leading_zeros_u32_softFunction · 0.85

Tested by

no test coverage detected