Loading...
Searching...
No Matches
bytes_le.h File Reference

Little-endian byte readers shared by the wire-decoding stores. More...

#include <stdint.h>

Go to the source code of this file.

Functions

static int16_t read_i16_le (const uint8_t *p)
 Reads a little-endian signed 16-bit value out of a byte pair.
static int32_t read_i32_le (const uint8_t *p)
 Reads a little-endian signed 32-bit value out of four bytes.

Detailed Description

Little-endian byte readers shared by the wire-decoding stores.

Each byte is read on its own and shifted into place rather than casting the pointer to a wider type, so the value comes out the same whatever the compiler believes about alignment or byte order. The casts are what carry the sign: the phone packs a temperature and a percent as signed values, and reading them unsigned turns a small negative into a large positive.