libosmocore  1.5.1
Osmocom core library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bit16gen.h File Reference

Go to the source code of this file.

Functions

static uint16_t osmo_load16le_ext (const void *p, uint8_t n)
 load unaligned n-byte integer (little-endian encoding) into uint16_t, into the least significant octets. More...
 
static uint16_t osmo_load16be_ext (const void *p, uint8_t n)
 load unaligned n-byte integer (big-endian encoding) into uint16_t, into the MOST significant octets. More...
 
static uint16_t osmo_load16be_ext_2 (const void *p, uint8_t n)
 load unaligned n-byte integer (big-endian encoding) into uint16_t, into the least significant octets. More...
 
static void osmo_store16le_ext (uint16_t x, void *p, uint8_t n)
 store unaligned n-byte integer (little-endian encoding) from uint16_t More...
 
static void osmo_store16be_ext (uint16_t x, void *p, uint8_t n)
 store unaligned n-byte integer (big-endian encoding) from uint16_t More...
 
static uint16_t osmo_load16le (const void *p)
 load unaligned 16-bit integer (little-endian encoding) More...
 
static uint16_t osmo_load16be (const void *p)
 load unaligned 16-bit integer (big-endian encoding) More...
 
static void osmo_store16le (uint16_t x, void *p)
 store unaligned 16-bit integer (little-endian encoding) More...
 
static void osmo_store16be (uint16_t x, void *p)
 store unaligned 16-bit integer (big-endian encoding) More...
 

Function Documentation

static uint16_t osmo_load16be ( const void *  p)
inlinestatic

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

References osmo_load16be_ext().

Referenced by bitvec_get_int16_msb(), bitvec_shiftl(), msgb_get_u16(), and msgb_pull_u16().

static uint16_t osmo_load16be_ext ( const void *  p,
uint8_t  n 
)
inlinestatic

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

WARNING: for n < sizeof(uint16_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_store16be_ext() before, use osmo_load16be_ext_2().

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

References n, and OSMO_ASSERT.

Referenced by osmo_load16be().

static uint16_t osmo_load16be_ext_2 ( const void *  p,
uint8_t  n 
)
inlinestatic

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

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

References n, and OSMO_ASSERT.

static uint16_t osmo_load16le ( const void *  p)
inlinestatic

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

References osmo_load16le_ext().

static uint16_t osmo_load16le_ext ( const void *  p,
uint8_t  n 
)
inlinestatic

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

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

References n, and OSMO_ASSERT.

Referenced by osmo_load16le().

static void osmo_store16be ( uint16_t  x,
void *  p 
)
inlinestatic

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

References osmo_store16be_ext().

Referenced by bitvec_shiftl(), msgb_push_u16(), and msgb_put_u16().

static void osmo_store16be_ext ( uint16_t  x,
void *  p,
uint8_t  n 
)
inlinestatic

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

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

References OSMO_ASSERT.

Referenced by osmo_store16be().

static void osmo_store16le ( uint16_t  x,
void *  p 
)
inlinestatic

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

References osmo_store16le_ext().

static void osmo_store16le_ext ( uint16_t  x,
void *  p,
uint8_t  n 
)
inlinestatic

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

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

References OSMO_ASSERT.

Referenced by osmo_store16le().