Contents

resetBytes(in:)

Replaces the contents of the data buffer with zeros for the provided range.

Declaration

mutating func resetBytes<R>(in range: R) where R : RangeExpression, Self.Index == R.Bound

Parameters

  • range:

    The range of bytes to replace with zeros.

Discussion

The following example sets the bytes to zero for the bytes identified by the provided range:

var dest: [UInt8] = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
dest.resetBytes(in: 1...3)
// dest = [0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF]