hedos-kernel 1.4.2

The hedos kernel: model records, registry, discovery, install planning, and resolution.
Documentation
1
2
3
4
5
6
7
8
9
//! Saturating byte arithmetic.

/// Sum the non-negative values, saturating at `i64::MAX` instead of overflowing.
/// Negative inputs are treated as zero.
pub(crate) fn saturating_sum(values: impl Iterator<Item = i64>) -> i64 {
    values.fold(0i64, |accumulated, value| {
        accumulated.saturating_add(value.max(0))
    })
}