Functions
Bit Utils

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)

Detailed Description

Bit field packing, unpacking and utility functions.


Function Documentation

s32 getbits ( const u8 buff,
u32  pos,
u8  len 
)

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.

Parameters:
posPosition in buffer of start of bit field in bits.
lenLength of bit field in bits.
Returns:
Bit field as a signed value.

Definition at line 49 of file bits.c.

u32 getbitu ( const u8 buff,
u32  pos,
u8  len 
)

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`.

Parameters:
posPosition in buffer of start of bit field in bits.
lenLength of bit field in bits.
Returns:
Bit field as an unsigned value.

Definition at line 27 of file bits.c.

void setbits ( u8 buff,
u32  pos,
u32  len,
s32  data 
)

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`.

Parameters:
posPosition in buffer of start of bit field in bits.
lenLength of bit field in bits.
dataSigned integer to be packed into bit field.

Definition at line 91 of file bits.c.

void setbitu ( u8 buff,
u32  pos,
u32  len,
u32  data 
)

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`.

Parameters:
posPosition in buffer of start of bit field in bits.
lenLength of bit field in bits.
dataUnsigned integer to be packed into bit field.

Definition at line 68 of file bits.c.



swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:57:01