libosmocore 1.11.1
Osmocom core library
Loading...
Searching...
No Matches
bit32gen.h File Reference

Go to the source code of this file.

Functions

static uint32_t osmo_load32le_ext (const void *p, uint8_t n)
 load unaligned n-byte integer (little-endian encoding) into uint32_t, into the least significant octets.
static uint32_t osmo_load32be_ext (const void *p, uint8_t n)
 load unaligned n-byte integer (big-endian encoding) into uint32_t, into the MOST significant octets.
static uint32_t osmo_load32be_ext_2 (const void *p, uint8_t n)
 load unaligned n-byte integer (big-endian encoding) into uint32_t, into the least significant octets.
static void osmo_store32le_ext (uint32_t x, void *p, uint8_t n)
 store unaligned n-byte integer (little-endian encoding) from uint32_t
static void osmo_store32be_ext (uint32_t x, void *p, uint8_t n)
 store unaligned n-byte integer (big-endian encoding) from uint32_t
static uint32_t osmo_load32le (const void *p)
 load unaligned 32-bit integer (little-endian encoding)
static uint32_t osmo_load32be (const void *p)
 load unaligned 32-bit integer (big-endian encoding)
static void osmo_store32le (uint32_t x, void *p)
 store unaligned 32-bit integer (little-endian encoding)
static void osmo_store32be (uint32_t x, void *p)
 store unaligned 32-bit integer (big-endian encoding)

Function Documentation

◆ osmo_load32be()

uint32_t osmo_load32be ( const void * p)
inlinestatic

load unaligned 32-bit integer (big-endian encoding)

References osmo_load32be_ext().

Referenced by msgb_get_u32(), and msgb_pull_u32().

◆ osmo_load32be_ext()

uint32_t osmo_load32be_ext ( const void * p,
uint8_t n )
inlinestatic

load unaligned n-byte integer (big-endian encoding) into uint32_t, into the MOST significant octets.

WARNING: for n < sizeof(uint32_t), the result is not returned in the least significant octets, as one might expect. To always return the same value as fed to osmo_store32be_ext() before, use osmo_load32be_ext_2().

Parameters
[in]pBuffer where integer is stored
[in]nNumber of bytes stored in p
Returns
32 bit unsigned integer

References OSMO_ASSERT.

Referenced by osmo_load32be().

◆ osmo_load32be_ext_2()

uint32_t osmo_load32be_ext_2 ( const void * p,
uint8_t n )
inlinestatic

load unaligned n-byte integer (big-endian encoding) into uint32_t, into the least significant octets.

Parameters
[in]pBuffer where integer is stored
[in]nNumber of bytes stored in p
Returns
32 bit unsigned integer

References OSMO_ASSERT.

◆ osmo_load32le()

uint32_t osmo_load32le ( const void * p)
inlinestatic

load unaligned 32-bit integer (little-endian encoding)

References osmo_load32le_ext().

◆ osmo_load32le_ext()

uint32_t osmo_load32le_ext ( const void * p,
uint8_t n )
inlinestatic

load unaligned n-byte integer (little-endian encoding) into uint32_t, into the least significant octets.

Parameters
[in]pBuffer where integer is stored
[in]nNumber of bytes stored in p
Returns
32 bit unsigned integer

References OSMO_ASSERT.

Referenced by osmo_load32le().

◆ osmo_store32be()

void osmo_store32be ( uint32_t x,
void * p )
inlinestatic

store unaligned 32-bit integer (big-endian encoding)

References osmo_store32be_ext(), and x.

Referenced by _gsmtap_raw_output(), msgb_push_u32(), and msgb_put_u32().

◆ osmo_store32be_ext()

void osmo_store32be_ext ( uint32_t x,
void * p,
uint8_t n )
inlinestatic

store unaligned n-byte integer (big-endian encoding) from uint32_t

Parameters
[in]xunsigned 32 bit integer
[out]pBuffer to store integer
[in]nNumber of bytes to store

References OSMO_ASSERT, and x.

Referenced by osmo_store32be().

◆ osmo_store32le()

void osmo_store32le ( uint32_t x,
void * p )
inlinestatic

store unaligned 32-bit integer (little-endian encoding)

References osmo_store32le_ext(), and x.

◆ osmo_store32le_ext()

void osmo_store32le_ext ( uint32_t x,
void * p,
uint8_t n )
inlinestatic

store unaligned n-byte integer (little-endian encoding) from uint32_t

Parameters
[in]xunsigned 32 bit integer
[out]pBuffer to store integer
[in]nNumber of bytes to store

References OSMO_ASSERT, and x.

Referenced by osmo_store32le().