peekDM

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

The array is **not** consumed.

  1. T peekDM(ushort[] words)
  2. T peekDM(ushort[] words, size_t index)
    T
    peekDM
    (
    T
    )
    (
    ushort[] words
    ,
    size_t index
    )

Parameters

T

The integral type to convert the first T.sizeof / 2 DM to.

words ushort[]

The array of DM to convert

index size_t

The index to start reading from (instead of starting at the front).

Examples

[0x645A, 0x3ffb].peekDM!float(0).shouldEqual(1.964F);
[0, 0, 0x645A, 0x3ffb].peekDM!float(2).shouldEqual(1.964F);
[0, 0, 0x645A, 0x3ffb].peekDM!float(0).shouldEqual(0);
[0x80, 0, 0].peekDM!ushort(0).shouldEqual(128);
[0xFFFF].peekDM!short(0).shouldEqual(-1);
[0xFFFF].peekDM!ushort(0).shouldEqual(65_535);
[0xFFF7].peekDM!ushort(0).shouldEqual(65_527);
[0xFFF7].peekDM!short(0).shouldEqual(-9);
[0xFFFB].peekDM!short(0).shouldEqual(-5);
[0xFFFB].peekDM!ushort(0).shouldEqual(65_531);
[0x8000].peekDM!short(0).shouldEqual(-32_768);

Meta