blob: ea9db1e9837e1a77df6619fb4811ff158467cef3 [file] [log] [blame]
//@ compile-flags: -Cdebug-assertions=yes
#![crate_type = "lib"]
#![feature(core_intrinsics)]
/// Emulates the default behavior of `+` using `intrinsics::overflow_checks()`.
#[inline]
pub fn add(a: u8, b: u8) -> u8 {
if core::intrinsics::overflow_checks() { a.strict_add(b) } else { a.wrapping_add(b) }
}