store_bytes

Mojo function 🡭

store_bytes

fn def store_bytes[dtype: DType, width: SIMDLength, o: MutOrigin, //](data: Span[UInt8, o], value: SIMD[dtype, width])

Write value over the leading bytes of data.

The inverse of load_bytes, and the in-place counterpart of to_bytes: it writes through the span rather than returning a fresh Array, so the caller pays no copy. Byte order is the target’s own, as in load_bytes.

Parameters:

  • dtype (DType): The lane type of the vector being written.
  • width (SIMDLength): The number of lanes in the vector.
  • o (MutOrigin): The (mutable) origin of the byte span.

Args:

  • data (Span[UInt8, o]): The bytes to overwrite; must hold at least width * size_of[dtype]() of them.
  • value (SIMD[dtype, width]): The vector to write.