def checked_add

mylsm-lsm-store@0.6.0.1 · src/StorageBytes.bend:76

import mylsm-lsm-store@0.6.0.1/src/StorageBytes.bend as StorageBytes
import Base

76# Return None rather than wrapping when U32 addition overflows.
77def checked_add(+left: U32, +right: U32) -> Maybe<&2, U32>:
78  Bool.pick(Maybe<&2, U32>, U32.is_le(left, (4294967295 - right : U32)), Some{(left + right : U32)}, None{})

Uses (6)

Used by (4)