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

Go to the source code of this file.

Functions

static uint64_t osmo_load64le_ext (const void *p, uint8_t n)
 load unaligned n-byte integer (little-endian encoding) into uint64_t, into the least significant octets.
static uint64_t osmo_load64be_ext (const void *p, uint8_t n)
 load unaligned n-byte integer (big-endian encoding) into uint64_t, into the MOST significant octets.
static uint64_t osmo_load64be_ext_2 (const void *p, uint8_t n)
 load unaligned n-byte integer (big-endian encoding) into uint64_t, into the least significant octets.
static void osmo_store64le_ext (uint64_t x, void *p, uint8_t n)
 store unaligned n-byte integer (little-endian encoding) from uint64_t
static void osmo_store64be_ext (uint64_t x, void *p, uint8_t n)
 store unaligned n-byte integer (big-endian encoding) from uint64_t
static uint64_t osmo_load64le (const void *p)
 load unaligned 64-bit integer (little-endian encoding)
static uint64_t osmo_load64be (const void *p)
 load unaligned 64-bit integer (big-endian encoding)
static void osmo_store64le (uint64_t x, void *p)
 store unaligned 64-bit integer (little-endian encoding)
static void osmo_store64be (uint64_t x, void *p)
 store unaligned 64-bit integer (big-endian encoding)

Function Documentation

◆ osmo_load64be()

uint64_t osmo_load64be ( const void * p)
inlinestatic

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

References osmo_load64be_ext().

◆ osmo_load64be_ext()

uint64_t osmo_load64be_ext ( const void * p,
uint8_t n )
inlinestatic

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

WARNING: for n < sizeof(uint64_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_store64be_ext() before, use osmo_load64be_ext_2().

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

References OSMO_ASSERT.

Referenced by osmo_load64be().

◆ osmo_load64be_ext_2()

uint64_t osmo_load64be_ext_2 ( const void * p,
uint8_t n )
inlinestatic

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

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

References OSMO_ASSERT.

◆ osmo_load64le()

uint64_t osmo_load64le ( const void * p)
inlinestatic

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

References osmo_load64le_ext().

◆ osmo_load64le_ext()

uint64_t osmo_load64le_ext ( const void * p,
uint8_t n )
inlinestatic

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

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

References OSMO_ASSERT.

Referenced by osmo_load64le().

◆ osmo_store64be()

void osmo_store64be ( uint64_t x,
void * p )
inlinestatic

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

References osmo_store64be_ext(), and x.

◆ osmo_store64be_ext()

void osmo_store64be_ext ( uint64_t x,
void * p,
uint8_t n )
inlinestatic

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

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

References OSMO_ASSERT, and x.

Referenced by osmo_encode_big_endian(), and osmo_store64be().

◆ osmo_store64le()

void osmo_store64le ( uint64_t x,
void * p )
inlinestatic

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

References osmo_store64le_ext(), and x.

◆ osmo_store64le_ext()

void osmo_store64le_ext ( uint64_t x,
void * p,
uint8_t n )
inlinestatic

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

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

References OSMO_ASSERT, and x.

Referenced by osmo_store64le().