Module sint

Module sint 

Source
Expand description

Minimal-length signed integers.

Two’s complement, little-endian, in the fewest octets that hold the value: one octet up to ±128, two up to ±32768, and so on to four. An altitude in meters is the motivating case — most of the world is within a byte of sea level, and the property that carries it is read over LoRa.

Decoding accepts any width from one to four octets, so a sender that pads to a fixed width is understood; encoding always produces the minimal form.

Enums§

Error

Constants§

MAX_LEN
Largest encoded size of a minimal signed integer.

Functions§

decode
Decode a one- to four-octet two’s-complement value.
encode
Encode value into out, returning the number of bytes written.
encoded_len
Return the encoded size of value in bytes.