dfins.util

Utility functions to convert PLC words

Members

Functions

fromBCD
ushort fromBCD(ushort bcd)

Converts BCD value into decimal format

peek
T peek(ushort[] words)

Takes an array of word ushort and converts the first T.sizeof / 2 word to T. The array is not consumed.

peek
T peek(ushort[] words, size_t index)

Takes an array of word (ushort) and converts the first T.sizeof / 2 word to T starting from index index.

pop
T pop(ref R input)

Takes an input range of words (ushort) and converts the first T.sizeof / 2 words to T. The array is consumed.

toBCD
ushort toBCD(ushort dec)

Converts ushort value into BDC format

toBytes
ubyte[] toBytes(T[] input)

Converts an array of type T into an ubyte array.

toWords
ushort[] toWords(ubyte[] bytes)

Converts an array of bytes into wordd ushort array.

write
void write(ref R output, T n)

Writes numeric type T into a output range of ushort.

Manifest constants

BYTES_PER_WORD
enum BYTES_PER_WORD;

Bytes per each word.

Meta