load_be

Mojo function 🡭

load_be

fn def load_be[dtype: DType, o: Origin[mut=o.mut]](data: Span[UInt8, o]) -> Scalar[dtype]

Assemble a big-endian word from a byte span.

Every byte of data is consumed, most-significant first; the caller picks dtype and slices data to the matching byte width (e.g. 4 bytes for DType.uint32, 8 bytes for DType.uint64).

Parameters:

  • dtype (DType): The scalar type to assemble.
  • o (Origin[mut=mut]): The origin of the byte span.

Args:

  • data (Span[UInt8, o]): The big-endian bytes to assemble.

Returns:

Scalar[dtype]: The assembled Scalar[dtype] value.