ToBEBytes method
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)
));