Source/Packages

Data.Bytes

packages/foundation/standard/src/Data/Bytes.alpha

1,218 lines172 declarations47.4 KiBSHA-256 beded7f8a171

def · lines 309–324

dataBytesRepeatByte

Full file
Batch single-byte repetitions into 4096-byte chunks. This is a construction granularity, not a maximum extent: quotient and remainder cover all bytes.
309def dataBytesRepeatByte =
310  (lambda unrestricted value : Byte . unrestricted count : Nat .
311    let unrestricted single =
312      (bytes-cons value b"")
313      in
314      nat-eliminate
315        (lambda unrestricted small : Nat . Bytes)
316        (let unrestricted block =
317          (dataBytesRepeat single 4096)
318          in
319          bytes-append
320            (dataBytesRepeat block (naturalDivideUnchecked count 4096))
321            (dataBytesRepeat single (naturalModuloUnchecked count 4096)))
322        (lambda unrestricted predecessor : Nat . unrestricted unused : Bytes .
323          dataBytesRepeat single count)
324        (nat-less-than count 4096))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.