networking · intermediate · ~15 min

Read a little-endian 16-bit sample

Decode a little-endian 16-bit value.

Challenge

IQ samples on the wire are often little-endian. Implement int parse_le16(const unsigned char *b) returning a 16-bit value with b[0] as the LOW byte and b[1] as the high byte.

Starter code

int parse_le16(const unsigned char *b) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.