def u32.width

bend-kit-bytes@0.3.3.0 · bytes.bend:783

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

783# The digit count of n, at most 10.
784def u32.width(f: Nat, small: Bool, +n: U32, +k: U32) -> U32:
785  match f:
786    case 0n:
787      k
788    case 1n+p:
789      match small:
790        case True{}:
791          k
792        case False{}:
793          u32.width(p, U32.is_lt((n / 10 : U32), 10), (n / 10 : U32), (k + 1 : U32))

Uses (6)

Used by (1)