Skip to content
FutureBlitz

    Install

    Import std.math.bits

    UInt8

    std.math.bits

    extend

    Extend UInt8

    Saturating arithmetic on UInt8s, which stops at the lowest and highest in place of overflowing.

    std/math/bits.fb, line 222

    • Public Method SaturatingAdd(other: UInt8): UInt8 method #

      The sum, or the lowest or highest UInt8 in place of an overflow.

      Examples

      Expect((250 As UInt8).SaturatingAdd(10) == 255)
      Expect((5 As UInt8).SaturatingSubtract(10) == 0)
    • Public Method SaturatingSubtract(other: UInt8): UInt8 method #

      The difference, or the lowest or highest UInt8 in place of an overflow.

    • Public Method SaturatingMultiply(other: UInt8): UInt8 method #

      The product, or the lowest or highest UInt8 in place of an overflow.

    Report an issue with this page or with FutureBlitz on GitHub.