(lhs: u128, rhs: u128)
| 295 | #[inline] |
| 296 | #[must_use] |
| 297 | pub const fn overflowing_add_u128(lhs: u128, rhs: u128) -> (u128, Choice) { |
| 298 | #[cfg(target_arch = "riscv32")] |
| 299 | { |
| 300 | overflowing_add_u128_halves(lhs, rhs) |
| 301 | } |
| 302 | #[cfg(not(target_arch = "riscv32"))] |
| 303 | { |
| 304 | let sum = lhs.wrapping_add(rhs); |
| 305 | let carry = ((lhs & rhs) | ((lhs | rhs) & !sum)) >> (u128::BITS - 1); |
| 306 | (sum, Choice::from_u128_lsb(carry)) |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | // RV32 can branch even in `u128::wrapping_add`, before computing the final carry. |
| 311 | // Keep this workaround local to that target, preserving native addition elsewhere. |
nothing calls this directly
no test coverage detected