(mut value: u32)
| 269 | #[inline] |
| 270 | #[allow(clippy::arithmetic_side_effects, reason = "shift is between 1 and 16")] |
| 271 | const fn leading_zeros_u32_soft(mut value: u32) -> u32 { |
| 272 | let mut count = 0u32; |
| 273 | let mut shift = 16; |
| 274 | while shift != 0 { |
| 275 | let mask = Choice::from_u32_nz(value >> (u32::BITS - shift)) |
| 276 | .not() |
| 277 | .to_u32_mask(); |
| 278 | value ^= mask & (value ^ (value << shift)); |
| 279 | count = count.wrapping_add(mask & shift); |
| 280 | shift >>= 1; |
| 281 | } |
| 282 | count.wrapping_add(Choice::from_u32_nz(value).not().to_u32_mask() & 1) |
| 283 | } |
| 284 | |
| 285 | /// Add two integers, returning the wrapping sum and [`Choice::TRUE`] on overflow. |
| 286 | #[inline] |
no test coverage detected