ToBEBytes method

L ToBEBytes(
  1. S ptr,
  2. int length
)

Serialises length words starting at ptr to a flat big-endian byte list.

Each word is split into byteSize bytes, most-significant byte first.

Implementation

L ToBEBytes(S ptr, int length) =>
  fromList(asDartList(ptr, length).expand((word) =>
    .generate(byteSize, (i) => (word.toInt() >> ((byteSize - 1 - i) * 8)) & 0xFF)
  ));