toBytes

Converts an array of type T into an ubyte array.

Omron stores data in LittleEndian format.

ubyte[]
toBytes
(
T
)
(
T[] input
)

Return Value

Type: ubyte[]

An array of ubyte

Examples

[0x8034].toBytes!ushort().shouldEqual([0x34, 0x80]);

ushort[] buf = [0x8034, 0x2010];
buf.toBytes!ushort().shouldEqual([0x34, 0x80, 0x10, 0x20]);
buf.length.shouldEqual(2);

[0x8034].toBytes!uint().shouldEqual([0x34, 0x80, 0, 0]);
[0x010464].toBytes!uint().shouldEqual([0x64, 0x04, 1, 0]);

Meta