Functions | |
s32 | getbits (const u8 *buff, u32 pos, u8 len) |
u32 | getbitu (const u8 *buff, u32 pos, u8 len) |
void | setbits (u8 *buff, u32 pos, u32 len, s32 data) |
void | setbitu (u8 *buff, u32 pos, u32 len, u32 data) |
Bit field packing, unpacking and utility functions.
Get bit field from buffer as a signed integer. Unpacks `len` bits at bit position `pos` from the start of the buffer. Maximum bit field length is 32 bits, i.e. `len <= 32`.
This function sign extends the `len` bit field to a signed 32 bit integer.
pos | Position in buffer of start of bit field in bits. |
len | Length of bit field in bits. |
Get bit field from buffer as an unsigned integer. Unpacks `len` bits at bit position `pos` from the start of the buffer. Maximum bit field length is 32 bits, i.e. `len <= 32`.
pos | Position in buffer of start of bit field in bits. |
len | Length of bit field in bits. |
Set bit field in buffer from a signed integer. Packs `len` bits into bit position `pos` from the start of the buffer. Maximum bit field length is 32 bits, i.e. `len <= 32`.
pos | Position in buffer of start of bit field in bits. |
len | Length of bit field in bits. |
data | Signed integer to be packed into bit field. |
Set bit field in buffer from an unsigned integer. Packs `len` bits into bit position `pos` from the start of the buffer. Maximum bit field length is 32 bits, i.e. `len <= 32`.
pos | Position in buffer of start of bit field in bits. |
len | Length of bit field in bits. |
data | Unsigned integer to be packed into bit field. |