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
Type: ushort[]

The array of DM to convert

index
Type: size_t

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

Examples

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

Meta