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

Function zero_counts_u32

ctutils/src/primitives.rs:349–362  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

347
348 #[test]
349 fn zero_counts_u32() {
350 for bit in 0..u32::BITS {
351 for value in [0, 1 << bit, !(1 << bit), u32::MAX >> bit] {
352 assert_eq!(leading_zeros_u32(value), value.leading_zeros());
353 assert_eq!(trailing_zeros_u32(value), value.trailing_zeros());
354 // Exercise the software fallback even on hosts with native instructions.
355 assert_eq!(leading_zeros_u32_soft(value), value.leading_zeros());
356 assert_eq!(
357 leading_zeros_u32_soft(value.reverse_bits()),
358 value.trailing_zeros()
359 );
360 }
361 }
362 }
363
364 #[test]
365 fn zero_counts_u64() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected