summaryrefslogtreecommitdiffstats
path: root/vendor/const-oid/src/checked.rs
blob: 7ff16a2a7b339df28a8c1b40e2f6d4e86f4dc96e (plain)
1
2
3
4
5
6
7
8
9
10
11
//! Checked arithmetic helpers.

/// `const fn`-friendly checked addition helper.
macro_rules! checked_add {
    ($a:expr, $b:expr) => {
        match $a.checked_add($b) {
            Some(n) => n,
            None => return Err(Error::Length),
        }
    };
}