Mir 1.0
Mir application programming interface
Supplementrary utility routines

Macros

#define MIRKL_BIT_SET(a, b)   ((a) |= (1ULL<<(b)))
 
#define MIRKL_BIT_CLEAR(a, b)   ((a) &= ~(1ULL<<(b)))
 
#define MIRKL_BIT_FLIP(a, b)   ((a) ^= (1ULL<<(b)))
 
#define MIRKL_BIT_CHECK(a, b)   ((a) & (1ULL<<(b)))
 
#define MIRKL_BITMASK_SET(x, y)   ((x) |= (y))
 
#define MIRKL_BITMASK_CLEAR(x, y)   ((x) &= (~(y)))
 
#define MIRKL_BITMASK_FLIP(x, y)   ((x) ^= (y))
 
#define MIRKL_BITMASK_CHECK_ALL(x, y)   (((x) & (y)) == (y))
 
#define MIRKL_BITMASK_CHECK_ANY(x, y)   ((x) & (y))
 

Functions

unsigned long mirkl_util_get_bits_from_word (const unsigned int val, const char from, const char to)
 
unsigned int mirkl_util_create_mask (unsigned int numEntries, unsigned int *maskWidth)
 
int mirkl_util_nsb32 (mirkl_uint32_t)
 Returns number of set bits in the input 32 bit unsigned integer.
 
int mirkl_util_nsb64 (mirkl_uint64_t)
 Returns number of set bits in the input 64 bit unsigned integer.
 
mirkl_size_t mirkl_util_dirname (const char *path, char *dst, mirkl_size_t siz)
 Directory name from path string. More...
 
mirkl_size_t mirkl_util_basename (const char *path, char *dst, mirkl_size_t siz)
 Base name from path string. More...
 
mirkl_uint32_t mirkl_util_crc32 (mirkl_uint32_t crc, const void *buf, mirkl_size_t size)
 Recompute the CRC32 for the data buffer. More...
 
mirkl_uint16_t mirkl_util_crc16 (mirkl_uint16_t crc, const void *buf, mirkl_size_t size)
 Recompute the CRC16 for the data buffer. More...
 

Detailed Description

Function Documentation

◆ mirkl_util_basename()

mirkl_size_t mirkl_util_basename ( const char *  path,
char *  dst,
mirkl_size_t  siz 
)

Base name from path string.

Parameters
[in]pathComplete path string to be processed.
[out]dstOutput buffer.
[in]sizSize of output buffer.
Returns
Length of the output string tried to create.

◆ mirkl_util_crc16()

mirkl_uint16_t mirkl_util_crc16 ( mirkl_uint16_t  crc,
const void *  buf,
mirkl_size_t  size 
)

Recompute the CRC16 for the data buffer.

The poly is 0x8005 (x^16 + x^15 + x^2 + 1)

Parameters
[in]crcprevious CRC value
[in]bufdata pointer
[in]sizenumber of bytes in the buffer
Returns
CRC16 value.

◆ mirkl_util_crc32()

mirkl_uint32_t mirkl_util_crc32 ( mirkl_uint32_t  crc,
const void *  buf,
mirkl_size_t  size 
)

Recompute the CRC32 for the data buffer.

Parameters
[in]crcprevious CRC value
[in]bufdata pointer
[in]sizenumber of bytes in the buffer
Returns
CRC32 value.

◆ mirkl_util_dirname()

mirkl_size_t mirkl_util_dirname ( const char *  path,
char *  dst,
mirkl_size_t  siz 
)

Directory name from path string.

Parameters
[in]pathComplete path string to be processed.
[out]dstOutput buffer.
[in]sizSize of output buffer.
Returns
Length of the output string tried to create.