toBytes

Converts an array of type T into an ubyte array.

Omron stores data in LittleEndian format.

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

Parameters

input
Type: T[]

array of type T to convert

Return Value

Type: ubyte[]

An array of ubyte

Examples

1 assert([0x8034].toBytes!ushort() == [0x34, 0x80]);
2 ushort[] buf = [0x8034, 0x2010];
3 assert(buf.toBytes!ushort() == [0x34, 0x80, 0x10, 0x20]);
4 assert(buf.length == 2);
5 
6 assert([0x8034].toBytes!uint() == [0x34, 0x80, 0, 0]);
7 assert([0x010464].toBytes!uint() == [0x64, 0x04, 1, 0]);

Meta